@@ -42,6 +42,75 @@ namespace GUI {
4242 };
4343
4444
45+ // Class of rounded backplate for better understability
46+ class RoundedBackplate : public TextureTemplate {
47+ public:
48+ RoundedBackplate (const Window& window, float centerX, float centerY, float width, float height,
49+ float radius, float border, Color frontColor = GREY, Color backColor = BLACK);
50+ RoundedBackplate (const Window& window, const SDL_FRect& rect, float radius, float border,
51+ Color frontColor = GREY, Color backColor = BLACK);
52+ ~RoundedBackplate ();
53+ };
54+
55+
56+ // Class with rectangular backplate for typeBox
57+ class RectBackplate : public TextureTemplate {
58+ public:
59+ RectBackplate (const Window& window, float centerX, float centerY, float width, float height,
60+ float border, Color frontColor = GREY, Color backColor = BLACK);
61+ RectBackplate (const Window& window, const SDL_FRect& rect,
62+ float border, Color frontColor = GREY, Color backColor = BLACK);
63+ ~RectBackplate ();
64+ };
65+
66+
67+ // Textures
68+ #if (USE_SDL_IMAGE) && (PRELOAD_TEXTURES)
69+ // Class of slider bar with point on it to control need parameter
70+ class Slider : public TextureTemplate {
71+ private:
72+ SDL_Texture *textureButton; // Texture of line (upper part of slider)
73+ SDL_FRect buttonRect; // Place for rendering upper part
74+ const unsigned maxValue; // Maximal value of state
75+
76+ public:
77+ // Create slide with need line and button images
78+ Slider (const Window& window, float X, float Y, float width, unsigned startValue,
79+ Textures lineImage = Textures::SliderLine, Textures buttonImage = Textures::SliderButton, unsigned max = 255 );
80+ unsigned setValue (float mouseX); // Setting new state from mouse position
81+ unsigned scroll (float wheelY); // Checking mouse wheel action
82+ void blit () const override ; // Drawing slider with need button position
83+ };
84+
85+
86+ // Class of buttons with image on it
87+ class ImageButton : public TextureTemplate {
88+ public:
89+ ImageButton (const Window& window, float X, float Y, float width, Textures name);
90+ };
91+ #endif
92+
93+
94+ // Animations
95+ #if (USE_SDL_IMAGE) && (PRELOAD_ANIMATIONS)
96+ class Animation : public TextureTemplate {
97+ private:
98+ const Animations type;
99+ const IMG_Animation* animation;
100+ unsigned frame = 0 ;
101+ timer prevTick;
102+
103+ public:
104+ Animation (const Window& window, float X, float Y, float width, float height, Animations type);
105+ Animation (const Window& window, const SDL_FRect& destination, Animations type);
106+ ~Animation ();
107+ void update ();
108+ };
109+ #endif
110+
111+
112+ // Text part
113+ #if (USE_SDL_FONT) && (PRELOAD_FONTS)
45114 // Static text on screen
46115 class StaticText : public TextureTemplate {
47116 public:
@@ -90,68 +159,6 @@ namespace GUI {
90159 };
91160
92161
93- // Class of slider bar with point on it to control need parameter
94- class Slider : public TextureTemplate {
95- private:
96- SDL_Texture *textureButton; // Texture of line (upper part of slider)
97- SDL_FRect buttonRect; // Place for rendering upper part
98- const unsigned maxValue; // Maximal value of state
99-
100- public:
101- // Create slide with need line and button images
102- Slider (const Window& window, float X, float Y, float width, unsigned startValue,
103- Textures lineImage = Textures::SliderLine, Textures buttonImage = Textures::SliderButton, unsigned max = 255 );
104- unsigned setValue (float mouseX); // Setting new state from mouse position
105- unsigned scroll (float wheelY); // Checking mouse wheel action
106- void blit () const override ; // Drawing slider with need button position
107- };
108-
109-
110- // Class of buttons with image on it
111- class ImageButton : public TextureTemplate {
112- public:
113- ImageButton (const Window& window, float X, float Y, float width, Textures name);
114- };
115-
116-
117- // Class of rounded backplate for better understability
118- class RoundedBackplate : public TextureTemplate {
119- public:
120- RoundedBackplate (const Window& window, float centerX, float centerY, float width, float height,
121- float radius, float border, Color frontColor = GREY, Color backColor = BLACK);
122- RoundedBackplate (const Window& window, const SDL_FRect& rect, float radius, float border,
123- Color frontColor = GREY, Color backColor = BLACK);
124- ~RoundedBackplate ();
125- };
126-
127-
128- // Class with rectangular backplate for typeBox
129- class RectBackplate : public TextureTemplate {
130- public:
131- RectBackplate (const Window& window, float centerX, float centerY, float width, float height,
132- float border, Color frontColor = GREY, Color backColor = BLACK);
133- RectBackplate (const Window& window, const SDL_FRect& rect,
134- float border, Color frontColor = GREY, Color backColor = BLACK);
135- ~RectBackplate ();
136- };
137-
138-
139- // GIF-animations
140- #if ANI_count
141- class GIFAnimation : public TextureTemplate {
142- private:
143- const Uint8 type;
144- Uint64 prevTick;
145- const SDL_FRect dest;
146-
147- public:
148- GIFAnimation (const Window& window, SDL_Rect destination, ANI_names type);
149- ~GIFAnimation ();
150- void blit () const ;
151- };
152- #endif
153-
154-
155162 // Class of field, where user can type text
156163 template <unsigned bufferSize = 16 >
157164 class TypeField : public TextureTemplate {
@@ -237,5 +244,6 @@ namespace GUI {
237244 void update ();
238245 void reset ();
239246 };
247+ #endif // (USE_SDL_FONT) && (PRELOAD_FONTS)
240248
241249} // namespace GUI
0 commit comments