Minesweeper / src / Tiles.h
Tiles.h
Raw
#include <SFML/Graphics.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
using namespace std;
#pragma once

class Tiles {

    sf::Sprite tile_hidden;
    sf::Sprite tile_revealed;
    sf::Sprite flag;
    sf::Sprite mine;
    sf::Sprite num1;
    sf::Sprite num2;
    sf::Sprite num3;
    sf::Sprite num4;
    sf::Sprite num5;
    sf::Sprite num6;
    sf::Sprite num7;
    sf::Sprite num8;


    int val;

    int mine_counter;

    bool num1On;
    bool num2On;
    bool num3On;
    bool num4On;
    bool num5On;
    bool num6On;
    bool num7On;
    bool num8On;

    bool hidden;
    bool flag_on;
    bool mine_set;
    bool debugOn;


public:
    Tiles();
    static Tiles* getTile(int x, int y, int columns,vector<Tiles>& tiles);

    void SetPosition(float xPosition, float yPosition);


    bool getMine();
    bool getFlipped();
    bool getDebugOn();
    bool getFlag();
    bool getDebug();

    int GetMineCount();

    void setDebugOn();
    void setDebugOff();
    void Draw(sf::RenderWindow& window);
    sf::FloatRect GetBounds();

    void setFlagOn();
    void FlipTile(bool val);
    void putFlag();
    void putMine(bool mine);
    void setMineCount(int count);

    void Reveal(int i,int j,int width, int height, vector<Tiles> &tiles,Tiles tile,bool firstClick);
    void adjacenttiles(int i, int j, int width, int height, vector<Tiles>& tiles, Tiles &tile);
    bool NotOutOfBounds(int i, int j, int rows, int columns);

};