Skip to content

Commit 57773cf

Browse files
committed
Rename offset theme param to font_offset
1 parent 132b929 commit 57773cf

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

resources/gui/default.theme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[base] {
22
font: gui/fonts/BigShouldersDisplay-SemiBold.ttf
33
# Positive offset moves the font down, negative moves it up.
4-
offset: 0.0
4+
font_offset: 20.0
55

66
[button] {
77
color: #ffffff

src/gui/theme.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool GuiTheme::loadTheme(const string& name, const string& resource_name)
9999
else
100100
global_style.color = {255, 255, 255, 255};
101101
global_style.font = getFont(input["font"]);
102-
global_style.offset = input["offset"].toFloat();
102+
global_style.font_offset = input["font_offset"].toFloat();
103103
global_style.size = input["size"].toFloat();
104104
global_style.sound = input["sound"];
105105
for(unsigned int n=0; n<int(GuiElement::State::COUNT); n++)
@@ -130,8 +130,8 @@ bool GuiTheme::loadTheme(const string& name, const string& resource_name)
130130
style.states[n].color = toColor(input["color." + postfix]);
131131
if (input.find("font." + postfix) != input.end())
132132
style.states[n].font = getFont(input["font." + postfix]);
133-
if (input.find("offset." + postfix) != input.end())
134-
style.states[n].offset = input["font." + postfix].toFloat();
133+
if (input.find("font_offset." + postfix) != input.end())
134+
style.states[n].font_offset = input["font_offset." + postfix].toFloat();
135135
if (input.find("size." + postfix) != input.end())
136136
style.states[n].size = input["size." + postfix].toFloat();
137137
if (input.find("sound." + postfix) != input.end())
@@ -155,7 +155,7 @@ GuiTheme::GuiTheme(const string& name)
155155
std::vector<string> fonts = findResources("gui/fonts/*.ttf");
156156
if(fonts.size() > 0)
157157
fallback_state.font = getFont(fonts[0]);
158-
fallback_state.offset = 0.0f;
158+
fallback_state.font_offset = 0.0f;
159159
fallback_state.texture = "";
160160
GuiThemeStyle fallback;
161161
for(unsigned int n=0; n<int(GuiElement::State::COUNT); n++)

src/gui/theme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GuiThemeStyle
1616
glm::u8vec4 color;
1717
float size; //general size parameter, depends on the widget type what it means.
1818
sp::Font* font;
19-
float offset = 0.0f;
19+
float font_offset = 0.0f;
2020
string sound; //Sound effect played by the widget on certain actions.
2121
};
2222
StateStyle states[int(GuiElement::State::COUNT)];

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ int main(int argc, char** argv)
170170

171171
// Apply baseline offset adjustments to fonts
172172
// Positive values move text down, negative values move text up
173-
main_font->setBaselineOffset(active_theme->getStyle("base")->get(GuiElement::State::Normal).offset);
174-
bold_font->setBaselineOffset(active_theme->getStyle("bold")->get(GuiElement::State::Normal).offset);
173+
main_font->setBaselineOffset(active_theme->getStyle("base")->get(GuiElement::State::Normal).font_offset);
174+
bold_font->setBaselineOffset(active_theme->getStyle("bold")->get(GuiElement::State::Normal).font_offset);
175175

176176
// On Android, this requires the 'record audio' permissions,
177177
// which is always a scary thing for users.

0 commit comments

Comments
 (0)