CCIMXDesktop
 
Loading...
Searching...
No Matches
Dinasour.h
1#ifndef DINASOUR_H
2#define DINASOUR_H
3#include "figure/FigureObject.h"
4#include <QPixmap>
9class Dinasour : public FigureObject {
10 Q_OBJECT
11public:
16 explicit Dinasour(QObject* parent = nullptr);
21 enum class State {
22 READY,
23 RUNNING,
24 LAYING,
25 /* src will be locked to the die frame */
26 DIE
27 };
32 bool isJumping() const { return is_jumping; }
36 void make_jump();
41 bool isLaying() const { return is_laying; }
46 void set_laying(bool st);
50 void process_animation();
55 void set_providing_state(State s);
60 QRect& provide_current_bounding_rect() override;
65 QPixmap& provide_drawing_srcframe() override;
66
67private:
68 /* frame sources */
69 DinasourFrameFetcher* normal_run;
70 DinasourFrameFetcher* lay_run;
71 QPixmap die_map;
72 QPixmap ready_map;
73
77 void setup_frame_provider();
78 QRect jump_rect;
79 State current_state { State::READY };
80 bool is_jumping { false };
81 bool is_laying { false };
82 int velocityY { 0 };
83};
84
85#endif // DINASOUR_H
Provides frame data for the dinosaur character based on its state.
Definition FigureFrameFetcher.h:15
State
States of Dinasour supports.
Definition Dinasour.h:21
bool isJumping() const
isJumping is our cute jumping?
Definition Dinasour.h:32
bool isLaying() const
isLaying is our cute laying(ducking actually...)?
Definition Dinasour.h:41
Abstract base class for all drawable game objects.
Definition FigureObject.h:10
Configuration constants related to the dinosaur figure.