Minesweeper: Add little icons to the flags and timer labels.

This commit is contained in:
Andreas Kling 2019-04-15 03:12:28 +02:00
parent 791e8f5bb0
commit c8e601a5d5
Notes: sideshowbarker 2024-07-19 14:42:21 +09:00
3 changed files with 5 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

View file

@ -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 };

View file

@ -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<GBoxLayout>(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);