CCIMXDesktop
 
Loading...
Searching...
No Matches
BirdObsticals.h
1#ifndef BIRDOBSTICALS_H
2#define BIRDOBSTICALS_H
3
4#include "Obsticals.h"
5
7
12class BirdObsticals : public Obsticals {
13 Q_OBJECT
14public:
19 enum class FlyHeight {
20 LOW,
21 MED,
22 HIG
23 };
24
29 enum class BirdType {
30 SMALL,
31 MEDIUM,
32 LARGE
33 };
34
36 static constexpr unsigned short HEIGHT_SIZE_TYPE_MAX = static_cast<unsigned short>(FlyHeight::HIG) + 1;
37
39 static constexpr unsigned short SZ_SIZE_TYPE_MAX = static_cast<unsigned short>(BirdType::LARGE) + 1;
40
45 explicit BirdObsticals(QObject* parent = nullptr);
46
51 void setHeight(FlyHeight h);
52
57 FlyHeight getHeight() const { return h; }
58
63 void setSize(BirdType t);
64
69 BirdType getSize() const { return type; }
70
75 void inline setAutoUpdateHeightRandomly(bool st) { auto_update_height = st; }
76
81 inline bool autoheightUpdateSzRandomly() const { return auto_update_height; }
82
87 void inline setAutoUpdateSzRandomly(bool st) { auto_update_size = st; }
88
93 inline bool autoUpdateSzRandomly() const { return auto_update_size; }
94
96 ~BirdObsticals() = default;
97
102 QRect& provide_current_bounding_rect() override;
103
108 QPixmap& provide_drawing_srcframe() override;
109
110private:
111 bool auto_update_height { true };
112 bool auto_update_size { true };
113 BirdFrameFetch* bird_frame_provider;
115 BirdType type { BirdType::SMALL };
116
120 void init_memory();
121
125 void update_frame();
126};
127
128#endif // BIRDOBSTICALS_H
Frame fetcher for bird-type obstacles.
Definition FigureFrameFetcher.h:115
Represents bird obstacles in the game.
Definition BirdObsticals.h:12
void setSize(BirdType t)
Sets bird size.
Definition BirdObsticals.cpp:36
void setAutoUpdateHeightRandomly(bool st)
Enables/disables automatic height updates.
Definition BirdObsticals.h:75
~BirdObsticals()=default
Default destructor.
FlyHeight
Possible flying heights for birds.
Definition BirdObsticals.h:19
@ MED
Medium flying height.
@ LOW
Low flying height.
@ HIG
High flying height.
static constexpr unsigned short SZ_SIZE_TYPE_MAX
Maximum number of size types.
Definition BirdObsticals.h:39
void setAutoUpdateSzRandomly(bool st)
Enables/disables automatic size updates.
Definition BirdObsticals.h:87
QPixmap & provide_drawing_srcframe() override
Provides current drawing frame.
Definition BirdObsticals.cpp:62
void setHeight(FlyHeight h)
Sets flying height.
Definition BirdObsticals.cpp:16
BirdType
Possible sizes for birds.
Definition BirdObsticals.h:29
@ LARGE
Large bird size.
@ SMALL
Small bird size.
@ MEDIUM
Medium bird size.
bool autoheightUpdateSzRandomly() const
Checks if height auto-update is enabled.
Definition BirdObsticals.h:81
BirdType getSize() const
Gets current bird size.
Definition BirdObsticals.h:69
bool autoUpdateSzRandomly() const
Checks if size auto-update is enabled.
Definition BirdObsticals.h:93
static constexpr unsigned short HEIGHT_SIZE_TYPE_MAX
Maximum number of height types.
Definition BirdObsticals.h:36
FlyHeight getHeight() const
Gets current flying height.
Definition BirdObsticals.h:57
QRect & provide_current_bounding_rect() override
Provides current collision bounding rect.
Definition BirdObsticals.cpp:58
Base class for all obstacle objects in the game.
Definition Obsticals.h:15