mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-12 23:23:35 +00:00
30 lines
620 B
C++
30 lines
620 B
C++
#include <Graphics/Sprite.h>
|
|
#include <Core/Script.h>
|
|
#include <Renderer/Image.h>
|
|
#include <Graphics/MeshFactory.h>
|
|
#include <Core/Logs.h>
|
|
|
|
namespace Scop
|
|
{
|
|
Sprite::Sprite(std::shared_ptr<Texture> texture)
|
|
{
|
|
Verify((bool)texture, "Sprite: invalid texture");
|
|
p_mesh = CreateQuad(0, 0, texture->GetWidth(), texture->GetHeight());
|
|
p_texture = texture;
|
|
if(p_script)
|
|
p_script->OnInit(this);
|
|
}
|
|
|
|
void Sprite::Update(NonOwningPtr<Scene> scene, Inputs& input, float delta)
|
|
{
|
|
if(p_script)
|
|
p_script->OnUpdate(scene, this, input, delta);
|
|
}
|
|
|
|
Sprite::~Sprite()
|
|
{
|
|
if(p_script)
|
|
p_script->OnQuit(this);
|
|
}
|
|
}
|