From c8e601a5d5054b598e363a322c8accad390a6026 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 15 Apr 2019 03:12:28 +0200 Subject: [PATCH] Minesweeper: Add little icons to the flags and timer labels. --- Base/res/icons/minesweeper/timer.png | Bin 0 -> 216 bytes Games/Minesweeper/Field.cpp | 1 + Games/Minesweeper/main.cpp | 4 ++++ 3 files changed, 5 insertions(+) create mode 100644 Base/res/icons/minesweeper/timer.png diff --git a/Base/res/icons/minesweeper/timer.png b/Base/res/icons/minesweeper/timer.png new file mode 100644 index 0000000000000000000000000000000000000000..d178078181db07e705437bc51be3d05aa5b96763 GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0y~yVBiN~4mJh`2J356y%-o6=6kw0hG?8$8gx+bumOkg z&NYknhrhUQozD7?=W(4^lcryBc$|!zQv&BTLnpn^!)45F@BhBrnO0*J8Kw~0IGZFgLuJ zXzP7;!I~ErpUBwVET8s4_USpv2)Q%;pI>)O^;G*gQ^RkqkCMEy!lX4a-==TBZ>klT V+P~OZje&uI!PC{xWt~$(69Ae8SR?=d literal 0 HcmV?d00001 diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp index fc6aceb543..e043e1d06e 100644 --- a/Games/Minesweeper/Field.cpp +++ b/Games/Minesweeper/Field.cpp @@ -188,6 +188,7 @@ void Field::paint_event(GPaintEvent& event) painter.add_clip_rect(event.rect()); auto inner_rect = frame_inner_rect(); + painter.add_clip_rect(inner_rect); for (int y = inner_rect.top() - 1; y <= inner_rect.bottom(); y += square_size()) { Point a { inner_rect.left(), y }; diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp index 6d286a07ef..d5c2a3f22f 100644 --- a/Games/Minesweeper/main.cpp +++ b/Games/Minesweeper/main.cpp @@ -25,8 +25,12 @@ int main(int argc, char** argv) container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); container->set_preferred_size({ 0, 36 }); container->set_layout(make(Orientation::Horizontal)); + auto* flag_icon_label = new GLabel(container); + flag_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/flag.png")); auto* flag_label = new GLabel(container); auto* face_button = new GButton(container); + auto* time_icon_label = new GLabel(container); + time_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/timer.png")); auto* time_label = new GLabel(container); auto* field = new Field(*flag_label, *time_label, *face_button, widget);