ES-DE/es-core/src/HelpStyle.cpp
2017-10-28 22:25:01 +02:00

36 lines
958 B
C++

#include "HelpStyle.h"
#include "ThemeData.h"
#include "Renderer.h"
#include "resources/Font.h"
HelpStyle::HelpStyle()
{
position = 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<Vector2f>("pos") * 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);
}