summary refs log tree commit diff stats
path: root/src/components/animatable.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-08 12:34:42 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-08 12:34:42 -0500
commitcefe66cdbb8786dc455657376e36f0ff8785d5bc (patch)
tree7e90536fad90f2954b3834dc4959f402883c32b3 /src/components/animatable.cpp
parentcec0ed92c4035c4421d3cc2448f5423fcbb7f7d4 (diff)
downloadtherapy-cefe66cdbb8786dc455657376e36f0ff8785d5bc.tar.gz
therapy-cefe66cdbb8786dc455657376e36f0ff8785d5bc.tar.bz2
therapy-cefe66cdbb8786dc455657376e36f0ff8785d5bc.zip
Introduced animated sprites
Also restyled a lot of the code.
Diffstat (limited to 'src/components/animatable.cpp')
-rw-r--r--src/components/animatable.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/components/animatable.cpp b/src/components/animatable.cpp deleted file mode 100644 index fcd277c..0000000 --- a/src/components/animatable.cpp +++ /dev/null
@@ -1,27 +0,0 @@
1#include "animatable.h"
2
3AnimatableComponent::AnimatableComponent(const char* filename, int frame_width, int frame_height, int frames_across)
4 : texture(filename), frame_width(frame_width), frame_height(frame_height), frames_across(frames_across)
5{
6
7}
8
9int AnimatableComponent::getFrame() const
10{
11 return frame;
12}
13
14void AnimatableComponent::setFrame(int frame)
15{
16 this->frame = frame;
17}
18
19const Texture& AnimatableComponent::getTexture() const
20{
21 return texture;
22}
23
24Rectangle AnimatableComponent::getFrameRect() const
25{
26 return {frame_width * (frame % frames_across), frame_height * (frame / frames_across), frame_width, frame_height};
27}