Minesweeper2  V1.1.1 Game in C++ by Górka Mateusz
Display.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "SFML/Graphics.hpp"
4 #include "Board.hpp"
5 #include "TField.hpp"
6 
11 class Display {
12 private:
27 
29  sf::Texture flag_texture;
30  sf::Texture click_texture;
31  sf::Sprite mode_butt;
32 
33  sf::Font font;
34 
35  sf::Texture start_texture;
36  sf::Sprite start_butt;
37 
38  sf::Texture mine_texture;
39  sf::Sprite mine_bg;
40  sf::Text mine_txt;
41 
42  sf::Texture stopwatch_texture;
43  sf::Sprite stopwatch_bg;
44  sf::Text stopwatch_txt;
45 
46 
48 public:
49  Vector2D *hintPos {NULL};
50 
52 private:
58  static TField* const pointer( const Field& field );
59 
60 public:
64  Display() = default;
65 
69  void config( const Vector2D& size );
70 
74  ~Display();
75 
76 public:
81  void changeButt( const bool mode );
82 
83 public:
89  void board( sf::RenderTarget& target, const Board* const board ) const;
90 
95  void draw( sf::RenderTarget& target ) const;
96 
101  void drawStart( sf::RenderTarget& target ) const
102  { target.draw( start_butt ); }
103 
108  void stopwatch( unsigned int seconds );
109 
114  void mineCounter( short signed int mine );
115 
119  inline void hideHint()
120  { if( hintPos ){ delete hintPos; hintPos = NULL; } }
121 
122 };
Display::board
void board(sf::RenderTarget &target, const Board *const board) const
Display board on the window.
Definition: Display.cpp:121
TField
Templete of field view.
Definition: TField.hpp:13
Display::stopwatch
void stopwatch(unsigned int seconds)
Update a value of stopwatch time.
Definition: Display.cpp:89
Vector2D_t< short int >
Display::mode_butt
sf::Sprite mode_butt
Mode button spirte.
Definition: Display.hpp:31
Display::mine_txt
sf::Text mine_txt
Mine counter counter text.
Definition: Display.hpp:40
Display::drawStart
void drawStart(sf::RenderTarget &target) const
Draw start button on interface.
Definition: Display.hpp:101
Display::mine_bg
sf::Sprite mine_bg
Mine counter counter background.
Definition: Display.hpp:39
Display::mine_texture
sf::Texture mine_texture
Mine counter counter backgroun texture.
Definition: Display.hpp:38
Display::stopwatch_bg
sf::Sprite stopwatch_bg
Stopwatch background.
Definition: Display.hpp:43
Display::hideHint
void hideHint()
Hide a hint.
Definition: Display.hpp:119
Display::hintPos
Vector2D * hintPos
Position of hint, NULL if no hint to display.
Definition: Display.hpp:49
Board
Board of game.
Definition: Board.hpp:11
Display::start_texture
sf::Texture start_texture
Mine counter counter backgroun texture.
Definition: Display.hpp:35
Display::flag_texture
sf::Texture flag_texture
Click mode flag texture.
Definition: Display.hpp:29
Display::click_texture
sf::Texture click_texture
Click mode "click" texture.
Definition: Display.hpp:30
Display::stopwatch_txt
sf::Text stopwatch_txt
Stopwatch text.
Definition: Display.hpp:44
Display::font
sf::Font font
Font.
Definition: Display.hpp:33
Display::Display
Display()=default
Construct a new Display object (default constructor)
Display::~Display
~Display()
Destroy the Display object.
Definition: Display.cpp:81
Display::mineCounter
void mineCounter(short signed int mine)
Update value of mine on the display.
Definition: Display.cpp:99
Display::config
void config(const Vector2D &size)
Config a Display class.
Definition: Display.cpp:30
NUM_FIELD_VIEW
#define NUM_FIELD_VIEW
Number of fields views.
Definition: Const.hpp:51
Display::stopwatch_texture
sf::Texture stopwatch_texture
Stopwatch background textrue.
Definition: Display.hpp:42
Display::start_butt
sf::Sprite start_butt
Mine counter counter background.
Definition: Display.hpp:36
Display::pointer
static TField *const pointer(const Field &field)
Field code to element on Templete array.
Definition: Display.cpp:14
Display::draw
void draw(sf::RenderTarget &target) const
Draw a interface of the game.
Definition: Display.cpp:106
Board.hpp
TField.hpp
Display::Template
static TField * Template[NUM_FIELD_VIEW]
Templates of Field view.
Definition: Display.hpp:26
Field
Field of the board.
Definition: Field.hpp:26
Display::changeButt
void changeButt(const bool mode)
Change a view of mode button.
Definition: Display.cpp:75
Display
Care about display on the interface.
Definition: Display.hpp:11