CCIMXDesktop
 
Loading...
Searching...
No Matches
CactusObsticals.h
1
6#ifndef CACTUSOBSTICALS_H
7#define CACTUSOBSTICALS_H
8#include "Obsticals.h"
9
13class CactusObsticals : public Obsticals {
14 Q_OBJECT
15public:
20 explicit CactusObsticals(QObject* parent = nullptr);
21
25 ~CactusObsticals() = default;
26
30 enum class Size {
31 SMALL,
32 MEDIUM,
33 LARGE
34 };
35
39 static constexpr const short SIZE_TYPE_MAX = static_cast<short>(Size::LARGE) + 1;
40
45 void setSize(Size s);
46
51 Size getSize() const { return size; }
52
57 void inline setAutoUpdateSzRandomly(bool st) { auto_update_sz = st; }
58
63 inline bool autoUpdateSzRandomly() const { return auto_update_sz; }
64
69 QRect& provide_current_bounding_rect() override;
70
75 QPixmap& provide_drawing_srcframe() override;
76
77private:
81 CactusFrameFetch* cactus_frame_provider;
82
86 Size size;
87
91 bool auto_update_sz { false };
92
96 void init_memory();
97
101 void update_frame();
102};
103
104#endif // CACTUSOBSTICALS_H
Frame fetcher for cactus-type obstacles.
Definition FigureFrameFetcher.h:88
CactusObsticals inherits from Obsticals and provides size and rendering control.
Definition CactusObsticals.h:13
Size getSize() const
Returns the current size of the cactus.
Definition CactusObsticals.h:51
void setSize(Size s)
Sets the cactus size.
Definition CactusObsticals.cpp:14
static constexpr const short SIZE_TYPE_MAX
Constant representing the number of size types.
Definition CactusObsticals.h:39
~CactusObsticals()=default
Default destructor.
bool autoUpdateSzRandomly() const
Checks if automatic random size update is enabled.
Definition CactusObsticals.h:63
Size
Enumeration for cactus size types.
Definition CactusObsticals.h:30
@ MEDIUM
Medium size.
QPixmap & provide_drawing_srcframe() override
Provides the drawing source frame (QPixmap) for the cactus.
Definition CactusObsticals.cpp:43
void setAutoUpdateSzRandomly(bool st)
Enables or disables automatic random size update.
Definition CactusObsticals.h:57
QRect & provide_current_bounding_rect() override
Provides the current bounding rectangle of the cactus.
Definition CactusObsticals.cpp:39
Base class for all obstacle objects in the game.
Definition Obsticals.h:15