Added AsloEngine 0.9.0 to Repository
This commit is contained in:
parent
d017dd84b3
commit
881e6c70f2
60 changed files with 2648 additions and 0 deletions
45
asloengine/spriteobject.cpp
Executable file
45
asloengine/spriteobject.cpp
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#include "headers/spriteobject.hpp"
|
||||
|
||||
namespace asloengine
|
||||
{
|
||||
|
||||
SpriteObject::SpriteObject(std::string _name)
|
||||
: GameObject(_name) {}
|
||||
|
||||
SpriteObject::SpriteObject(std::string _name, sf::Texture& _texture)
|
||||
: GameObject(_name)
|
||||
{
|
||||
|
||||
load_texture(_texture);
|
||||
|
||||
}
|
||||
|
||||
SpriteObject::~SpriteObject() {}
|
||||
|
||||
void SpriteObject::load_texture(sf::Texture& _texture)
|
||||
{
|
||||
|
||||
sprite = sf::Sprite(_texture);
|
||||
|
||||
on_main_property_update();
|
||||
|
||||
}
|
||||
|
||||
void SpriteObject::draw()
|
||||
{
|
||||
|
||||
render_window->draw(sprite);
|
||||
|
||||
}
|
||||
|
||||
void SpriteObject::on_main_property_update()
|
||||
{
|
||||
|
||||
sprite.setScale(scale);
|
||||
sprite.setPosition(position);
|
||||
sprite.setOrigin(origin * sprite.getLocalBounds());
|
||||
sprite.setRotation(rotation);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue