summaryrefslogtreecommitdiff
path: root/Games/Minesweeper
diff options
context:
space:
mode:
authorHüseyin ASLITÜRK <asliturk@hotmail.com>2020-06-13 12:33:25 +0300
committerAndreas Kling <kling@serenityos.org>2020-06-18 16:35:57 +0200
commitd0411f3756403209a4e477de2aaed3cb6fedfef0 (patch)
tree3a72b1b676c320a36bfc37230043164a9f94ef67 /Games/Minesweeper
parent0a2dc1f5c0f32ac8af19f1260756e6b460d05849 (diff)
downloadserenity-d0411f3756403209a4e477de2aaed3cb6fedfef0.zip
Minesweeper: Replace Label with Image component to show flag and timer
Diffstat (limited to 'Games/Minesweeper')
-rw-r--r--Games/Minesweeper/main.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp
index 7f9a380892..a57715d07e 100644
--- a/Games/Minesweeper/main.cpp
+++ b/Games/Minesweeper/main.cpp
@@ -31,6 +31,7 @@
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
+#include <LibGUI/Image.h>
#include <LibGUI/Label.h>
#include <LibGUI/Menu.h>
#include <LibGUI/MenuBar.h>
@@ -65,15 +66,19 @@ int main(int argc, char** argv)
container.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
container.set_preferred_size(0, 36);
container.set_layout<GUI::HorizontalBoxLayout>();
- auto& flag_icon_label = container.add<GUI::Label>();
- flag_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/flag.png"));
+
+ auto& flag_image = container.add<GUI::Image>();
+ flag_image.load_from_file("/res/icons/minesweeper/flag.png");
+
auto& flag_label = container.add<GUI::Label>();
auto& face_button = container.add<GUI::Button>();
face_button.set_button_style(Gfx::ButtonStyle::CoolBar);
face_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
face_button.set_preferred_size(36, 0);
- auto& time_icon_label = container.add<GUI::Label>();
- time_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/timer.png"));
+
+ auto& time_image = container.add<GUI::Image>();
+ time_image.load_from_file("/res/icons/minesweeper/timer.png");
+
auto& time_label = container.add<GUI::Label>();
auto& field = widget.add<Field>(flag_label, time_label, face_button, [&](auto size) {
size.set_height(size.height() + container.preferred_size().height());