@@ -42,54 +42,6 @@ namespace GUI {
4242 };
4343
4444
45- // Static text on screen
46- class StaticText : public TextureTemplate {
47- public:
48- StaticText (const Window& window, float X, float Y, const LanguagedText texts,
49- float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
50- ~StaticText ();
51- };
52-
53-
54- // Static text on screen
55- class HighlightedStaticText : public TextureTemplate {
56- public:
57- HighlightedStaticText (const Window& window, float X, float Y, const LanguagedText texts, int frameThickness,
58- float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
59- ~HighlightedStaticText ();
60- };
61-
62-
63- // Dynamicly updated text on screen
64- class DynamicText : public TextureTemplate {
65- private:
66- const LanguagedText texts; // Text to create from
67- const float posX; // Relative positions on screen
68- const Aligment aligment; // Aligment type to improve displasment
69- const Color color; // Base draw color
70- const float height; // Height of text to draw
71-
72- public:
73- DynamicText (const Window& window, float X, float Y, const LanguagedText texts,
74- float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
75- ~DynamicText ();
76- template <typename ...Args>
77- void setValues (Args&& ...args) {
78- // Checking for all chars
79- char buffer[100 ];
80- std::snprintf (buffer, sizeof (buffer), texts.getString ().c_str (), args...);
81-
82- // Creating surface with text
83- texture = window.createTexture (Fonts::Main, height, buffer, 0 , color);
84-
85- // Moving draw rect to new place
86- rect.w = texture->w ;
87- rect.h = texture->h ;
88- rect.x = window.getWidth () * posX - (rect.w * (unsigned )aligment / 2 );
89- }
90- };
91-
92-
9345 // Class of slider bar with point on it to control need parameter
9446 class Slider : public TextureTemplate {
9547 private:
@@ -107,13 +59,6 @@ namespace GUI {
10759 };
10860
10961
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-
11762 // Class of rounded backplate for better understability
11863 class RoundedBackplate : public TextureTemplate {
11964 public:
@@ -136,22 +81,82 @@ namespace GUI {
13681 };
13782
13883
139- // GIF-animations
140- #if ANI_count
141- class GIFAnimation : public TextureTemplate {
84+ // Textures
85+ #if (USE_SDL_IMAGE) && (PRELOAD_TEXTURES)
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 {
14297 private:
14398 const Uint8 type;
14499 Uint64 prevTick;
145100 const SDL_FRect dest;
146101
147102 public:
148- GIFAnimation (const Window& window, SDL_Rect destination, ANI_names type);
149- ~GIFAnimation ();
103+ Animation (const Window& window, SDL_FRect destination, ANI_names type);
104+ ~Animation ();
150105 void blit () const ;
151106 };
152107 #endif
153108
154109
110+ // Text part
111+ #if (USE_SDL_FONT) && (PRELOAD_FONTS)
112+ // Static text on screen
113+ class StaticText : public TextureTemplate {
114+ public:
115+ StaticText (const Window& window, float X, float Y, const LanguagedText texts,
116+ float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
117+ ~StaticText ();
118+ };
119+
120+
121+ // Static text on screen
122+ class HighlightedStaticText : public TextureTemplate {
123+ public:
124+ HighlightedStaticText (const Window& window, float X, float Y, const LanguagedText texts, int frameThickness,
125+ float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
126+ ~HighlightedStaticText ();
127+ };
128+
129+
130+ // Dynamicly updated text on screen
131+ class DynamicText : public TextureTemplate {
132+ private:
133+ const LanguagedText texts; // Text to create from
134+ const float posX; // Relative positions on screen
135+ const Aligment aligment; // Aligment type to improve displasment
136+ const Color color; // Base draw color
137+ const float height; // Height of text to draw
138+
139+ public:
140+ DynamicText (const Window& window, float X, float Y, const LanguagedText texts,
141+ float height = Height::Main, Color color = WHITE, Aligment aligment = Aligment::Midle);
142+ ~DynamicText ();
143+ template <typename ...Args>
144+ void setValues (Args&& ...args) {
145+ // Checking for all chars
146+ char buffer[100 ];
147+ std::snprintf (buffer, sizeof (buffer), texts.getString ().c_str (), args...);
148+
149+ // Creating surface with text
150+ texture = window.createTexture (Fonts::Main, height, buffer, 0 , color);
151+
152+ // Moving draw rect to new place
153+ rect.w = texture->w ;
154+ rect.h = texture->h ;
155+ rect.x = window.getWidth () * posX - (rect.w * (unsigned )aligment / 2 );
156+ }
157+ };
158+
159+
155160 // Class of field, where user can type text
156161 template <unsigned bufferSize = 16 >
157162 class TypeField : public TextureTemplate {
@@ -237,5 +242,6 @@ namespace GUI {
237242 void update ();
238243 void reset ();
239244 };
245+ #endif // (USE_SDL_FONT) && (PRELOAD_FONTS)
240246
241247} // namespace GUI
0 commit comments