CCIMXDesktop
 
Loading...
Searching...
No Matches
settings_figure.h
Go to the documentation of this file.
1
6#ifndef SETTINGS_FIGURE_H
7#define SETTINGS_FIGURE_H
8
10#include "settings_common.h"
11
12namespace Settings {
13namespace Figure {
14
19 struct FigureSize {
20 unsigned short width;
21 unsigned short height;
22 };
23
28 struct Position {
29 unsigned short x;
30 unsigned short y;
31 };
32
33 // Helper functions for C++17 compatibility
34
40 inline constexpr unsigned short getWidth(const FigureSize& fs) noexcept {
41 return fs.width;
42 }
43
49 inline constexpr unsigned short getHeight(const FigureSize& fs) noexcept {
50 return fs.height;
51 }
52
58 inline constexpr unsigned short getX(const Position& p) noexcept {
59 return p.x;
60 }
61
67 inline constexpr unsigned short getY(const Position& p) noexcept {
68 return p.y;
69 }
70
74 static constexpr unsigned short FIGURE_FRAME_FLUSH_MS = 200;
75
80 namespace Dinasour {
81 static constexpr FigureSize DinasourSZ = { 60, 60 };
82 static constexpr unsigned short WIDTH = getWidth(DinasourSZ);
83 static constexpr unsigned short HEIGHT = getHeight(DinasourSZ);
84
85 static constexpr Position DinasourPOS = { 60, Scene::Ground::GROUND_Y_POS - HEIGHT };
86 static constexpr unsigned short X = getX(DinasourPOS);
87 static constexpr unsigned short Y = getY(DinasourPOS);
88
89 static constexpr const char* FRAME_1 = ":/frame/frames/dino_frame1.png";
90 static constexpr const char* FRAME_2 = ":/frame/frames/dino_frame2.png";
91 static constexpr const char* FRAME_SHIT = ":/frame/frames/ah_shit.png";
92
93 static constexpr const short JUMP_ABILITY = -18;
94 }
95
100 namespace Obstacle {
101 static constexpr const unsigned short MOVE_BOUND_OUT = 501;
102 static constexpr const unsigned short MOVE_BOUND_GAP = 350;
103 }
104
109 namespace Cactus {
110 static constexpr FigureSize CactusSZ_SMALL = { 20, 65 };
111 static constexpr FigureSize CactusSZ_MED = { 25, 85 };
112 static constexpr FigureSize CactusSZ_LARGE = { 30, 110 };
113 static constexpr FigureSize DEF_SZ = CactusSZ_SMALL;
114
115 static constexpr unsigned short WIDTH = getWidth(DEF_SZ);
116 static constexpr unsigned short HEIGHT = getHeight(DEF_SZ);
117
118 static constexpr unsigned int SMALL_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(CactusSZ_SMALL);
119 static constexpr unsigned int MED_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(CactusSZ_MED);
120 static constexpr unsigned int LARGE_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(CactusSZ_LARGE);
121
122 static constexpr Position INIT_POS = { Scene::SCENE_FIXED_SZ.first - 40, SMALL_BASE_Y_POS };
123 static constexpr unsigned short X = getX(INIT_POS);
124 static constexpr unsigned short Y = getY(INIT_POS);
125
126 static constexpr const char* FRAME_1 = ":/frame/frames/cac_frame1.png";
127 static constexpr const char* FRAME_2 = ":/frame/frames/cac_frame2.png";
128 static constexpr const char* FRAME_3 = ":/frame/frames/cac_frame3.png";
129 static constexpr const char* FRAME_4 = ":/frame/frames/cac_frame4.png";
130 }
131
136 namespace Bird {
137 static constexpr const unsigned int BIRD_APPEAR_AT_MSEC = 10000;
138
139 static constexpr FigureSize SmallBirdSize = { 30, 30 };
140 static constexpr FigureSize MediumBirdSize = { 45, 50 };
141 static constexpr FigureSize LargeBirdSize = { 60, 60 };
142
143 static constexpr unsigned int SMALL_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(SmallBirdSize);
144 static constexpr unsigned int MED_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(MediumBirdSize);
145 static constexpr unsigned int LARGE_BASE_Y_POS = Scene::Ground::GROUND_Y_POS - getHeight(LargeBirdSize);
146
147 static constexpr unsigned short WIDTH = getWidth(SmallBirdSize);
148 static constexpr unsigned short HEIGHT = getHeight(SmallBirdSize);
149
150 static constexpr const char* FRAME_1 = ":/frame/frames/bird1.png";
151 static constexpr const char* FRAME_2 = ":/frame/frames/bird2.png";
152
153 static constexpr const unsigned short LOW_HEIGHT = Scene::Ground::GROUND_Y_POS - HEIGHT - 5;
154 static constexpr const unsigned short MED_HEIGHT = Scene::Ground::GROUND_Y_POS - HEIGHT - 45;
155 static constexpr const unsigned short HIG_HEIGHT = Scene::Ground::GROUND_Y_POS - HEIGHT - 180;
156
157 static constexpr Position INIT_POS = { Scene::SCENE_FIXED_SZ.first - 40, LOW_HEIGHT };
158 static constexpr unsigned short X = getX(INIT_POS);
159 static constexpr unsigned short Y = getY(INIT_POS);
160 }
161
162} // namespace Figure
163} // namespace Settings
164
165#endif // SETTINGS_FIGURE_H
Configuration constants for bird obstacles.
Configuration constants for cactus obstacles.
Configuration constants related to the dinosaur figure.
General configuration for obstacles.
Defines constants and settings related to the game scene and its behavior.
constexpr unsigned short getY(const Position &p) noexcept
Gets the Y coordinate from a Position.
Definition settings_figure.h:67
constexpr unsigned short getWidth(const FigureSize &fs) noexcept
Gets the width from a FigureSize.
Definition settings_figure.h:40
constexpr unsigned short getX(const Position &p) noexcept
Gets the X coordinate from a Position.
Definition settings_figure.h:58
constexpr unsigned short getHeight(const FigureSize &fs) noexcept
Gets the height from a FigureSize.
Definition settings_figure.h:49
Represents the width and height of a figure.
Definition settings_figure.h:19
unsigned short height
Height of the figure.
Definition settings_figure.h:21
unsigned short width
Width of the figure.
Definition settings_figure.h:20
Represents a 2D position with x and y coordinates.
Definition settings_figure.h:28
unsigned short x
X coordinate.
Definition settings_figure.h:29
unsigned short y
Y coordinate.
Definition settings_figure.h:30