diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-08 12:34:42 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-08 12:34:42 -0500 |
| commit | cefe66cdbb8786dc455657376e36f0ff8785d5bc (patch) | |
| tree | 7e90536fad90f2954b3834dc4959f402883c32b3 /src/components/animatable.cpp | |
| parent | cec0ed92c4035c4421d3cc2448f5423fcbb7f7d4 (diff) | |
| download | therapy-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.cpp | 27 |
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 | |||
| 3 | AnimatableComponent::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 | |||
| 9 | int AnimatableComponent::getFrame() const | ||
| 10 | { | ||
| 11 | return frame; | ||
| 12 | } | ||
| 13 | |||
| 14 | void AnimatableComponent::setFrame(int frame) | ||
| 15 | { | ||
| 16 | this->frame = frame; | ||
| 17 | } | ||
| 18 | |||
| 19 | const Texture& AnimatableComponent::getTexture() const | ||
| 20 | { | ||
| 21 | return texture; | ||
| 22 | } | ||
| 23 | |||
| 24 | Rectangle AnimatableComponent::getFrameRect() const | ||
| 25 | { | ||
| 26 | return {frame_width * (frame % frames_across), frame_height * (frame / frames_across), frame_width, frame_height}; | ||
| 27 | } | ||
