1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:47:44 +00:00

Minesweeper: Add flag counter and game timer.

This commit is contained in:
Andreas Kling 2019-04-14 21:01:52 +02:00
parent adc91d92a3
commit 1503834c3b
3 changed files with 37 additions and 4 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <LibGUI/GFrame.h>
#include <LibCore/CTimer.h>
class SquareButton;
class GButton;
@ -19,7 +20,7 @@ struct Square {
class Field final : public GFrame {
public:
Field(GButton& face_button, GWidget* parent);
Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidget* parent);
virtual ~Field() override;
int rows() const { return m_rows; }
@ -55,5 +56,10 @@ private:
RetainPtr<GraphicsBitmap> m_flag_bitmap;
RetainPtr<GraphicsBitmap> m_number_bitmap[8];
GButton& m_face_button;
GLabel& m_flag_label;
GLabel& m_time_label;
CTimer m_timer;
int m_seconds_elapsed { 0 };
int m_flags_left { 0 };
Face m_face { Face::Default };
};