@@ -19,19 +19,20 @@ namespace GUI {
1919
2020
2121 // Graphic user interface template for other objects
22- class GUItemplate {
22+ class Template {
2323 protected:
2424 SDL_Texture* texture;
2525 SDL_FRect rect;
26+
2627 public:
27- GUItemplate ();
28+ Template ();
2829 virtual void blit () const ;
2930 bool in (const Mouse mouse) const ;
3031 };
3132
3233
3334 // Static text on screen
34- class StaticText : public GUItemplate {
35+ class StaticText : public Template {
3536 public:
3637 StaticText (float X, float Y, const LanguagedText texts,
3738 float size, Color color = WHITE, Aligment aligment = Aligment::Midle);
@@ -40,22 +41,22 @@ namespace GUI {
4041
4142
4243 // Static text on screen
43- class HighlightedStaticText : public GUItemplate {
44+ class HighlightedStaticText : public Template {
4445 public:
45- HighlightedStaticText (float X, float Y, const LanguagedText texts,
46+ HighlightedStaticText (float X, float Y, const LanguagedText texts,
4647 int frameThickness, float size, Color color = WHITE, Aligment aligment = Aligment::Midle);
4748 ~HighlightedStaticText ();
4849 };
4950
5051
5152 // Dynamicly updated text on screen
52- class DynamicText : public GUItemplate {
53+ class DynamicText : public Template {
5354 private:
54- const LanguagedText texts; // Text to create from
55- const float posX; // Relative positions on screen
56- const Aligment aligment; // Aligment type to improve displasment
57- const Color color; // Base draw color
58- const float height; // Height of text to draw
55+ const LanguagedText texts; // Text to create from
56+ const float posX; // Relative positions on screen
57+ const Aligment aligment; // Aligment type to improve displasment
58+ const Color color; // Base draw color
59+ const float height; // Height of text to draw
5960
6061 public:
6162 DynamicText (float X, float Y, const LanguagedText texts,
@@ -65,10 +66,10 @@ namespace GUI {
6566 void setValues (Args&& ...args) {
6667 // Checking for all chars
6768 char buffer[100 ];
68- std::sprintf (buffer, texts.getString ().c_str (), std::forward<Args>( args) ...);
69+ std::snprintf (buffer, sizeof (buffer), texts.getString ().c_str (), args...);
6970
7071 // Creating surface with text
71- texture = window.createTexture (FNT_MAIN , height, buffer, 0 , color);
72+ texture = window.createTexture (Fonts::Main , height, buffer, 0 , color);
7273
7374 // Moving draw rect to new place
7475 rect.w = texture->w ;
@@ -79,35 +80,34 @@ namespace GUI {
7980
8081
8182 // Class of slider bar with point on it to control need parameter
82- class Slider : public GUItemplate {
83+ class Slider : public Template {
8384 private:
8485 SDL_Texture *textureButton; // Texture of line (upper part of slider)
8586 SDL_FRect buttonRect; // Place for rendering upper part
8687 const unsigned maxValue; // Maximal value of state
8788
8889 public:
8990 // Create slide with need line and button images
90- Slider (float X, float Y, float width, unsigned startValue, IMG_names lineImage = IMG_GUI_SLIDER_LINE ,
91- IMG_names buttonImage = IMG_GUI_SLIDER_BUTTON , unsigned max = 255 );
91+ Slider (float X, float Y, float width, unsigned startValue, Textures lineImage = Textures::SliderLine ,
92+ Textures buttonImage = Textures::SliderButton , unsigned max = 255 );
9293 unsigned setValue (float mouseX); // Setting new state from mouse position
9394 unsigned scroll (float wheelY); // Checking mouse wheel action
9495 void blit () const override ; // Drawing slider with need button position
9596 };
9697
9798
9899 // Class of buttons with image on it
99- class ImageButton : public GUItemplate {
100- public:
101- ImageButton (float X, float Y, float width, IMG_names textureIndex );
100+ class ImageButton : public Template {
101+ public:
102+ ImageButton (float X, float Y, float width, Textures name );
102103 };
103104
104105
105106 // GIF-animations
106107 #if ANI_count
107- class GIFAnimation : public GUItemplate {
108+ class GIFAnimation : public Template {
108109 private:
109110 const Uint8 type;
110- SDL_Texture* texture = nullptr ;
111111 Uint64 prevTick;
112112 const SDL_FRect dest;
113113
@@ -167,7 +167,7 @@ namespace GUI {
167167 };
168168
169169 // Class of backplate for
170- class Backplate : public GUItemplate {
170+ class Backplate : public Template {
171171 public:
172172 Backplate (float centerX, float centerY, float width, float height, float radius, float border,
173173 Color frontColor = GREY, Color backColor = BLACK);
@@ -176,6 +176,7 @@ namespace GUI {
176176 ~Backplate ();
177177 };
178178
179+
179180 // Class of buttons with text on it
180181 class TextButton : public HighlightedStaticText {
181182 private:
@@ -187,6 +188,7 @@ namespace GUI {
187188 void blit () const override ;
188189 };
189190
191+
190192 // Class of appearing for time and hidden by time text
191193 class InfoBox : public HighlightedStaticText {
192194 private:
0 commit comments