charcoal/OpenGLEngine/Sprite.cpp
elipzer a8abb4afc9 Added a Sprite class to render 2D things
The sprite inherits from Poseable. It is intended to allow for
pure 2D rendering or integration of sprites/particles into 3D
scenes. Eventually an ImageScene should be created to test out the
image loading, sprite movement and rotation, and 2D camera
functionality for the builtin engine.
2018-10-08 15:19:48 -04:00

28 lines
524 B
C++

#include "Sprite.h"
namespace charcoal
{
Sprite::Sprite(const vec2& position) : Poseable(vec3(position, 0.0f))
{}
void Sprite::update_position(const vec2& position)
{
Poseable::update_position(vec3(position, 0.0f));
}
void Sprite::update_rotation(float angle)
{
Poseable::reset_orientation();
rotate(angle);
}
void Sprite::translate(const vec2& translation)
{
Poseable::translate(vec3(translation, 0.0f));
}
void Sprite::rotate(float angle)
{
Poseable::rotate(vec3(0.0f, 0.0f, 1.0f), angle);
}
}