forked from fieldofcows/EmulationStation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpStyle.cpp
More file actions
35 lines (28 loc) · 991 Bytes
/
HelpStyle.cpp
File metadata and controls
35 lines (28 loc) · 991 Bytes
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
#include "HelpStyle.h"
#include "ThemeData.h"
#include "Renderer.h"
#include "resources/Font.h"
HelpStyle::HelpStyle()
{
position = Eigen::Vector2f(Renderer::getScreenWidth() * 0.012f, Renderer::getScreenHeight() * 0.9515f);
iconColor = 0x777777FF;
textColor = 0x777777FF;
if(FONT_SIZE_SMALL != 0)
font = Font::get(FONT_SIZE_SMALL);
else
font = nullptr;
}
void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view)
{
auto elem = theme->getElement(view, "help", "helpsystem");
if(!elem)
return;
if(elem->has("pos"))
position = elem->get<Eigen::Vector2f>("pos").cwiseProduct(Eigen::Vector2f((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()));
if(elem->has("textColor"))
textColor = elem->get<unsigned int>("textColor");
if(elem->has("iconColor"))
iconColor = elem->get<unsigned int>("iconColor");
if(elem->has("fontPath") || elem->has("fontSize"))
font = Font::getFromTheme(elem, ThemeFlags::ALL, font);
}