45 lines
837 B
C
45 lines
837 B
C
|
// MAP CLASS, CONTAINS ALL LOGIC AND WINNING/LOSING TESTS
|
||
|
|
||
|
#ifndef MAP_H
|
||
|
#define MAP_H
|
||
|
|
||
|
class Tile;
|
||
|
|
||
|
class Map
|
||
|
{
|
||
|
private:
|
||
|
Tile* m_Layout;
|
||
|
|
||
|
int m_SizeX;
|
||
|
int m_SizeY;
|
||
|
int m_numOfBombs;
|
||
|
|
||
|
int m_PlacesLeft;
|
||
|
bool m_MapDone;
|
||
|
|
||
|
void DecrementFreePlaces();
|
||
|
|
||
|
public:
|
||
|
Map(int sizeX, int sizeY, int numBombs);
|
||
|
~Map();
|
||
|
|
||
|
void Render(); // render to window
|
||
|
|
||
|
inline bool IsMapWon() { return m_PlacesLeft == 0; }
|
||
|
inline bool IsMapDone() { return m_MapDone; }
|
||
|
void WinMap();
|
||
|
void LoseMap();
|
||
|
|
||
|
// generate map depending on amount of parameters
|
||
|
void Generate();
|
||
|
void GenerateFrom(int x, int y);
|
||
|
bool GenerateFromClick(int mouseX, int mouseY);
|
||
|
|
||
|
// process input
|
||
|
void ClickAt(int mouseX, int mouseY);
|
||
|
void RightClickAt(int mouseX, int mouseY);
|
||
|
void Reveal(int indexX, int indexY);
|
||
|
};
|
||
|
|
||
|
#endif
|