-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathTheme.hpp
95 lines (75 loc) · 1.94 KB
/
Theme.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef GUI_THEME_HPP
#define GUI_THEME_HPP
#include <map>
#include <string>
#include <SFML/Window.hpp>
#include <SFML/Graphics/Font.hpp>
#include "Widget.hpp"
#include "Utils/Box.hpp"
namespace gui
{
class Theme
{
public:
/**
* Load the GUI global font
*/
static bool loadFont(const std::string& path);
static const sf::Font& getFont();
/**
* Load the GUI spritesheet
*/
static bool loadTexture(const std::string& path);
static const sf::Texture& getTexture();
static const sf::IntRect& getTextureRect(Box::Type type, State state);
static const sf::IntRect& getCrossTextureRect();
static const sf::IntRect& getArrowTextureRect();
static const sf::IntRect& getProgressBarTextureRect();
/**
* Widget height based on text size
*/
static float getBoxHeight();
/**
* Height of a line of text
*/
static int getLineSpacing();
static size_t textSize;
struct Style
{
sf::Color textColor;
sf::Color textColorHover;
sf::Color textColorFocus;
sf::Color textSelectionColor;
sf::Color textPlaceholderColor;
};
static Style click;
static Style input;
static sf::Color windowBgColor;
static int borderSize;
static int minWidgetWidth;
static float PADDING; // Spacing inside widget
static float MARGIN; // Spacing between widgets
static sf::Keyboard::Key previousWidgetKey;
static sf::Keyboard::Key nextWidgetKey;
// Auto-initialized to default cursor
static sf::Cursor& cursor;
private:
enum TextureID
{
BOX_DEFAULT,
BOX_HOVERED,
BOX_PRESSED,
BOX_FOCUSED,
BOX_INPUT_DEFAULT,
BOX_INPUT_FOCUSED,
CROSS,
ARROW,
PROGRESS_BAR,
_TEXTURE_ID_COUNT
};
static sf::Font m_font;
static sf::Texture m_texture;
static sf::IntRect m_subrects[_TEXTURE_ID_COUNT];
};
}
#endif // GUI_THEME_HPP