![]() |
Oficina Framework
1.3
Games Framework
|
Represents an Animation, a set of controls for animating objects using SpriteSheets. More...
#include <RenderingSystem.hpp>
Classes | |
struct | AnimationSpecs |
A struct representing the specs of a single animation. More... | |
Public Member Functions | |
Animation (SpriteSheet *sheet) | |
Constructs an animation. More... | |
~Animation () | |
Desructs the animation. More... | |
void | update () |
Updates the animation. More... | |
void | Draw (vec2 Position, float magnification, Color4 tint, RenderEffect re=MODULATE_EFFECT) |
Draws the animation. More... | |
void | dispose () |
Disposes the animation. More... | |
SpriteSheet * | GetSpriteSheet () |
Gets the SpriteSheet of this Animation. More... | |
void | RegisterAnimation (std::string AnimationName, word frame_begin, word frame_end, float speed) |
Registers an animation on the database of this Animation class. More... | |
void | RegisterAnimation (std::string AnimationName, word frame_begin, word frame_end, word frame_loop, float speed) |
Registers an animation on the database of this Animation class. More... | |
void | RegisterAnimation (std::string AnimationName, AnimationSpecs specs) |
Registers an animation on the database of this Animation class. More... | |
float | GetAnimationSpeed () const |
Gets the current speed of the animation. More... | |
void | SetAnimationSpeed (float speed) |
Sets the current speed of the animation. More... | |
void | SetAnimation (std::string AnimationName) |
Sets the current animation, if registered. More... | |
void | SetOrientation (RenderProperty rp) |
Sets the orientation of the animation. More... | |
RenderProperty | GetOrientation () const |
Gets the orientation of the animation. More... | |
std::string | GetCurrentAnimationName () const |
Gets the name of the currently playing animation. More... | |
dword | GetCurrentFrame () const |
Gets the current animation frame playing. More... | |
vec2dw | GetFrameSize () const |
Gets the size of a single frame. More... | |
void | SetAngle (float angle) |
Sets the current animation angle. More... | |
float | GetAngle () const |
Gets the current animation angle. More... | |
void | SetAlpha (float alpha) |
Sets the alpha ratio of the animation. More... | |
float | GetAlpha () const |
Gets the alpha ratio of the animation. More... | |
float | GetDefaultAnimationSpeed () const |
Gets the default animation speed. More... | |
vec2 | GetHotspot () const |
Gets the hotspot of the animation. More... | |
void | SetSyncToFramerate (bool state) |
Sets or unsets whether the animation should synchonized to the current framerate. More... | |
bool | IsSyncToFramerate () |
Gets whether the animation is synchronized to the current framerate. More... | |
Represents an Animation, a set of controls for animating objects using SpriteSheets.
OficinaFramework::RenderingSystem::Animation::Animation | ( | SpriteSheet * | sheet | ) |
Constructs an animation.
sheet | Pointer to the SpriteSheet containing the frames to be used. |
OficinaFramework::RenderingSystem::Animation::~Animation | ( | ) |
Desructs the animation.
void OficinaFramework::RenderingSystem::Animation::dispose | ( | ) |
Disposes the animation.
void OficinaFramework::RenderingSystem::Animation::Draw | ( | vec2 | Position, |
float | magnification, | ||
Color4 | tint, | ||
RenderEffect | re = MODULATE_EFFECT |
||
) |
Draws the animation.
Position | Position of the center of the animation to be used. |
magnification | Magnification of the frame. Defaults to 1.0. |
tint | Color to tint the sprite. Defaults to White (1.0f, 1.0f, 1.0f, 1.0f). The alpha factor will be used to measure intensity of tinting. |
re | Effect when rendering the texture. Defaults to MODULATE_EFFECT. |
float OficinaFramework::RenderingSystem::Animation::GetAlpha | ( | ) | const |
Gets the alpha ratio of the animation.
float OficinaFramework::RenderingSystem::Animation::GetAngle | ( | ) | const |
Gets the current animation angle.
float OficinaFramework::RenderingSystem::Animation::GetAnimationSpeed | ( | ) | const |
Gets the current speed of the animation.
std::string OficinaFramework::RenderingSystem::Animation::GetCurrentAnimationName | ( | ) | const |
Gets the name of the currently playing animation.
dword OficinaFramework::RenderingSystem::Animation::GetCurrentFrame | ( | ) | const |
Gets the current animation frame playing.
float OficinaFramework::RenderingSystem::Animation::GetDefaultAnimationSpeed | ( | ) | const |
Gets the default animation speed.
vec2dw OficinaFramework::RenderingSystem::Animation::GetFrameSize | ( | ) | const |
Gets the size of a single frame.
vec2 OficinaFramework::RenderingSystem::Animation::GetHotspot | ( | ) | const |
Gets the hotspot of the animation.
RenderProperty OficinaFramework::RenderingSystem::Animation::GetOrientation | ( | ) | const |
Gets the orientation of the animation.
SpriteSheet* OficinaFramework::RenderingSystem::Animation::GetSpriteSheet | ( | ) |
Gets the SpriteSheet of this Animation.
bool OficinaFramework::RenderingSystem::Animation::IsSyncToFramerate | ( | ) |
Gets whether the animation is synchronized to the current framerate.
void OficinaFramework::RenderingSystem::Animation::RegisterAnimation | ( | std::string | AnimationName, |
word | frame_begin, | ||
word | frame_end, | ||
float | speed | ||
) |
Registers an animation on the database of this Animation class.
AnimationName | Name for the animation to be recognized when called. |
frame_begin | Frame in which the animation begins on the SpriteSheet. |
frame_end | Frame in which the animation ends on the SpriteSheet. |
speed | Speed of each frame of the animation in seconds. |
void OficinaFramework::RenderingSystem::Animation::RegisterAnimation | ( | std::string | AnimationName, |
word | frame_begin, | ||
word | frame_end, | ||
word | frame_loop, | ||
float | speed | ||
) |
Registers an animation on the database of this Animation class.
AnimationName | Name for the animation to be recognized when called. |
frame_begin | Frame in which the animation begins on the SpriteSheet. |
frame_end | Frame in which the animation ends on the SpriteSheet. |
frame_loop | Frame in which the animation loop begins on the SpriteSheet. |
speed | Speed of each frame of the animation in seconds. |
void OficinaFramework::RenderingSystem::Animation::RegisterAnimation | ( | std::string | AnimationName, |
AnimationSpecs | specs | ||
) |
Registers an animation on the database of this Animation class.
AnimationName | Name for the animation to be recognized when called. |
specs | Specs of the animation. |
void OficinaFramework::RenderingSystem::Animation::SetAlpha | ( | float | alpha | ) |
Sets the alpha ratio of the animation.
alpha | Alpha ratio to be given to the animation, ranged 0~1. |
void OficinaFramework::RenderingSystem::Animation::SetAngle | ( | float | angle | ) |
Sets the current animation angle.
angle | Angle to be given to the animation, in degrees. |
void OficinaFramework::RenderingSystem::Animation::SetAnimation | ( | std::string | AnimationName | ) |
Sets the current animation, if registered.
AnimationName | Name for the animation to be played. |
void OficinaFramework::RenderingSystem::Animation::SetAnimationSpeed | ( | float | speed | ) |
Sets the current speed of the animation.
speed | New duration for each frame of the animation, ranged 0.01f~1.0f. |
void OficinaFramework::RenderingSystem::Animation::SetOrientation | ( | RenderProperty | rp | ) |
Sets the orientation of the animation.
rp | Orientation to be given to the animation. |
void OficinaFramework::RenderingSystem::Animation::SetSyncToFramerate | ( | bool | state | ) |
Sets or unsets whether the animation should synchonized to the current framerate.
state | State to be given to the sync property. |
void OficinaFramework::RenderingSystem::Animation::update | ( | ) |
Updates the animation.