Skip to content

Commit

Permalink
Add "origin" theming element for help prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
benjdero committed Apr 15, 2018
1 parent b622a42 commit 1b4a545
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions THEMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ EmulationStation borrows the concept of "nine patches" from Android (or "9-Slice
#### helpsystem
* `pos` - type: NORMALIZED_PAIR. Default is "0.012 0.9515"
* `origin` - type: NORMALIZED_PAIR.
- Where on the component `pos` refers to. For example, an origin of `0.5 0.5` and a `pos` of `0.5 0.5` would place the component exactly in the middle of the screen.
* `textColor` - type: COLOR. Default is 777777FF.
* `iconColor` - type: COLOR. Default is 777777FF.
* `fontPath` - type: PATH.
Expand Down
4 changes: 4 additions & 0 deletions es-core/src/HelpStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
HelpStyle::HelpStyle()
{
position = Vector2f(Renderer::getScreenWidth() * 0.012f, Renderer::getScreenHeight() * 0.9515f);
origin = Vector2f(0.0f, 0.0f);
iconColor = 0x777777FF;
textColor = 0x777777FF;

Expand All @@ -24,6 +25,9 @@ void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::s
if(elem->has("pos"))
position = elem->get<Vector2f>("pos") * Vector2f((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());

if(elem->has("origin"))
origin = elem->get<Vector2f>("origin");

if(elem->has("textColor"))
textColor = elem->get<unsigned int>("textColor");

Expand Down
1 change: 1 addition & 0 deletions es-core/src/HelpStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ThemeData;
struct HelpStyle
{
Vector2f position;
Vector2f origin;
unsigned int iconColor;
unsigned int textColor;
std::shared_ptr<Font> font;
Expand Down
1 change: 1 addition & 0 deletions es-core/src/ThemeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>> The
{ "path", PATH } } },
{ "helpsystem", {
{ "pos", NORMALIZED_PAIR },
{ "origin", NORMALIZED_PAIR },
{ "textColor", COLOR },
{ "iconColor", COLOR },
{ "fontPath", PATH },
Expand Down
1 change: 1 addition & 0 deletions es-core/src/components/HelpComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void HelpComponent::updateGrid()

mGrid->setPosition(Vector3f(mStyle.position.x(), mStyle.position.y(), 0.0f));
//mGrid->setPosition(OFFSET_X, Renderer::getScreenHeight() - mGrid->getSize().y() - OFFSET_Y);
mGrid->setOrigin(mStyle.origin);
}

std::shared_ptr<TextureResource> HelpComponent::getIconTexture(const char* name)
Expand Down

0 comments on commit 1b4a545

Please sign in to comment.