aboutsummaryrefslogtreecommitdiff
path: root/src/gui/GsrPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/GsrPage.cpp')
-rw-r--r--src/gui/GsrPage.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/gui/GsrPage.cpp b/src/gui/GsrPage.cpp
index e6ee5fc..663187c 100644
--- a/src/gui/GsrPage.cpp
+++ b/src/gui/GsrPage.cpp
@@ -8,8 +8,9 @@
namespace gsr {
static const float button_spacing_scale = 0.015f;
- GsrPage::GsrPage() :
- label_text("Settings", get_theme().title_font)
+ GsrPage::GsrPage(const char *top_text, const char *bottom_text) :
+ top_text(top_text, get_theme().title_font),
+ bottom_text(bottom_text, get_theme().title_font)
{
const float margin = 0.02f;
set_margins(margin, margin, margin, margin);
@@ -80,13 +81,17 @@ namespace gsr {
window.draw(background);
const int text_margin = background.get_size().y * 0.085;
- label_text.set_position((background.get_position() + mgl::vec2f(background.get_size().x * 0.5f - label_text.get_bounds().size.x * 0.5f, text_margin)).floor());
- window.draw(label_text);
+
+ top_text.set_position((background.get_position() + mgl::vec2f(background.get_size().x * 0.5f - top_text.get_bounds().size.x * 0.5f, text_margin)).floor());
+ window.draw(top_text);
mgl::Sprite icon(&get_theme().settings_texture);
icon.set_height((int)(background.get_size().y * 0.5f));
icon.set_position((background.get_position() + background.get_size() * 0.5f - icon.get_size() * 0.5f).floor());
window.draw(icon);
+
+ bottom_text.set_position((background.get_position() + mgl::vec2f(background.get_size().x * 0.5f - bottom_text.get_bounds().size.x * 0.5f, background.get_size().y - bottom_text.get_bounds().size.y - text_margin)).floor());
+ window.draw(bottom_text);
}
void GsrPage::draw_buttons(mgl::Window &window, mgl::vec2f body_pos, mgl::vec2f body_size) {
@@ -102,15 +107,8 @@ namespace gsr {
void GsrPage::draw_children(mgl::Window &window, mgl::vec2f position) {
Widget *selected_widget = selected_child_widget;
- mgl_scissor prev_scissor;
- mgl_window_get_scissor(window.internal_window(), &prev_scissor);
-
- const mgl::vec2f inner_size = get_inner_size();
- mgl_scissor new_scissor = {
- mgl_vec2i{(int)position.x, (int)position.y},
- mgl_vec2i{(int)inner_size.x, (int)inner_size.y}
- };
- mgl_window_set_scissor(window.internal_window(), &new_scissor);
+ const mgl::Scissor prev_scissor = window.get_scissor();
+ window.set_scissor({position.to_vec2i(), get_inner_size().to_vec2i()});
for(size_t i = 0; i < widgets.size(); ++i) {
auto &widget = widgets[i];
@@ -121,7 +119,7 @@ namespace gsr {
if(selected_widget)
selected_widget->draw(window, position);
- mgl_window_set_scissor(window.internal_window(), &prev_scissor);
+ window.set_scissor(prev_scissor);
}
mgl::vec2f GsrPage::get_size() {