mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-12 07:03:34 +00:00
initial commit
This commit is contained in:
29
ScopEngine/Runtime/Sources/Graphics/Sprite.cpp
git.filemode.normal_file
29
ScopEngine/Runtime/Sources/Graphics/Sprite.cpp
git.filemode.normal_file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user