52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "minefield.hpp"
|
|
#include <memory>
|
|
#include <gtkmm.h>
|
|
#include <glibmm.h>
|
|
#include <gdkmm.h>
|
|
#include <sigc++/sigc++.h>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
|
|
#define PROJECT_NAME "minesweeper"
|
|
|
|
|
|
class MainWindow : public Gtk::Window
|
|
{
|
|
Gtk::Box boxV{Gtk::Orientation::VERTICAL};
|
|
Gtk::Box boxH{Gtk::Orientation::HORIZONTAL};
|
|
std::vector<std::shared_ptr<Gtk::ToggleButton>> buttons;
|
|
Gtk::Grid grid;
|
|
Gtk::HeaderBar bar;
|
|
Gtk::Button newGameButton;
|
|
Gtk::Button optionButton;
|
|
Gtk::Label flagLabel;
|
|
Gtk::Label clockLabel;
|
|
MineField field {16, 16, 40};
|
|
int m_elapsedTime;
|
|
bool newGame;
|
|
std::shared_ptr<Gdk::Texture> m_textureBomb;
|
|
std::shared_ptr<Gdk::Texture> m_textureFlag;
|
|
std::shared_ptr<Gdk::Texture> m_textureFlagBomb;
|
|
void updateCell(int x, int y);
|
|
void openBombs();
|
|
void updateFlagsLabel(int flags);
|
|
void updateClockLabel(size_t time);
|
|
void gameWon();
|
|
void gameOver();
|
|
sigc::connection clockSignalConn;
|
|
// void OpenNearCells(int index);
|
|
// void Explode();xo
|
|
// bool AllCellsOpened();
|
|
|
|
public:
|
|
MainWindow();
|
|
// void OnNewButtonClick();
|
|
void OnCellClick(int x, int y);
|
|
void OnCellRightClick(int n_press, double n_x, double n_y, int index);
|
|
// void ShowGameWonAnimation();
|
|
// void ApplyStyles();
|
|
// bool UpdateClockLabel();
|
|
};
|