- Note
- This Source File belongs to Minesweeper Game Example. Please follow the link for example explanation.
#pragma once
#include "FieldCell.h"
#include "AUI/Platform/ACustomCaptionWindow.h"
#include "CellView.h"
class MinesweeperWindow :
public AWindow {
public:
void beginGame(int columns, int rows, int bombs);
MinesweeperWindow();
[[nodiscard]]
bool isReveal() const { return mReveal; }
private:
int mFieldColumns;
int mFieldRows;
bool mBombsPlanted = false;
int mBombs;
int mOpenedCells;
void openCell(int x, int y, bool doGameLoseIfBomb);
int countBombsAround(int x, int y);
bool isValidCell(int x, int y) { return x >= 0 && x < mFieldColumns && y >= 0 && y < mFieldRows; }
FieldCell& fieldAt(int x, int y) { return mField[mFieldColumns * y + x]; }
bool mReveal = false;
void newGame();
void updateCellViewStyle(int x, int y) const;
void setupEventHandlers(
int x,
int y,
const _<CellView>& cell);
};
A std::vector with AUI extensions.
Definition AVector.h:39
Represents a window in the underlying windowing system.
Definition AWindow.h:45
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179