From 62125796c3227c43db3218e308c85e26cdac2843 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 3 May 2021 18:07:15 +0200 Subject: [PATCH] Minesweeper: Tweak main UI layout a little bit Move the clock/flag icons closer to their respective text labels. --- Userland/Games/Minesweeper/main.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 66db46e78d..e08a898b4d 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -70,19 +69,35 @@ int main(int argc, char** argv) container.set_fixed_height(36); container.set_layout(); - auto& flag_image = container.add(); - flag_image.load_from_file("/res/icons/minesweeper/flag.png"); + container.layout()->add_spacer(); + + auto& flag_image = container.add(); + flag_image.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/flag.png")); + flag_image.set_fixed_width(16); auto& flag_label = container.add(); + flag_label.set_autosize(true); + flag_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); + + container.layout()->add_spacer(); + auto& face_button = container.add(); face_button.set_focus_policy(GUI::FocusPolicy::TabFocus); face_button.set_button_style(Gfx::ButtonStyle::Coolbar); face_button.set_fixed_size(36, 36); - auto& time_image = container.add(); - time_image.load_from_file("/res/icons/minesweeper/timer.png"); + container.layout()->add_spacer(); + + auto& time_image = container.add(); + time_image.set_fixed_width(16); + time_image.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/timer.png")); auto& time_label = container.add(); + time_label.set_autosize(true); + time_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); + + container.layout()->add_spacer(); + auto& field = widget.add(flag_label, time_label, face_button, [&](auto size) { size.set_height(size.height() + container.min_size().height()); window->resize(size);