diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-30 21:02:27 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-30 21:02:27 +0100 |
commit | 6ae0b9038e432869b506cbdfe2779e97d3732d87 (patch) | |
tree | 7fadff8dd2125c48422ab10c6faa532650f8327a /src/crepe/api/Animator.h | |
parent | 1520cb55ad714583c3903f2988b0fdc38ede9c18 (diff) |
improved animator
Diffstat (limited to 'src/crepe/api/Animator.h')
-rw-r--r-- | src/crepe/api/Animator.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/crepe/api/Animator.h b/src/crepe/api/Animator.h index 6c506aa..ede450a 100644 --- a/src/crepe/api/Animator.h +++ b/src/crepe/api/Animator.h @@ -18,11 +18,6 @@ class SDLContext; class Animator : public Component { public: - //TODO: need to implement this - void loop(); - void stop(); - -public: /** * \brief Constructs an Animator object that will control animations for a sprite sheet. * @@ -57,15 +52,32 @@ private: //! The current row being animated. int curr_row = 0; - //TODO: Is this necessary? - //int fps; + //! should the animation loop + bool looping = false; + + //! starting frame for cycling + int cycle_start = 0; + + //! end frame for cycling (-1 --> use last frame) + int cycle_end = -1; + + //! frames per second for animation + int fps = 1; + + int offset_x = 0; + +public: + void loop() { this->looping = true; } + void play() {this->active = true;} + void pause() {this->active = false;} + void stop() {this->active = false; this->curr_col = 0; this->curr_row = 0;} + void set_fps(int fps) {this->fps = fps;} + void set_cycle_range(int start, int end) {this->cycle_start = start, this->cycle_end = end;} + void set_anim(int col) {this->curr_row = 0; this->curr_col = col; } private: //! AnimatorSystem adjust the private member parameters of Animator; friend class AnimatorSystem; - - //! SDLContext reads the Animator member var's - friend class SDLContext; }; } // namespace crepe // |