Pacman Torben Petré
Loading...
Searching...
No Matches
Window.h
Go to the documentation of this file.
1#ifndef WINDOW_H
2#define WINDOW_H
3
4#include <SFML/Graphics.hpp>
5
6
7class Window {
8public:
12 Window(Window &other) = delete;
13 void operator=(const Window &) = delete;
14
20 [[nodiscard]] static Window& getInstance();
21
22
23 //
24 // Directly exposing SFML RenderWindow methods to reduce verbosity.
25 //
26
27
33 [[nodiscard]] bool isOpen() const;
34
46 [[nodiscard]] bool pollEvent(sf::Event& event);
47
53 void draw(const sf::Drawable& drawable);
54
58 void clear();
59
63 void display();
64
68 void close();
69
83 void setFramerateLimit(unsigned int frameRate);
84
98 void setView(const sf::View& view);
99
106 [[nodiscard]] unsigned int getWidth() const;
107
114 [[nodiscard]] unsigned int getHeight() const;
115
116private:
117 Window();
118
119 sf::RenderWindow window;
120};
121
122
123#endif //WINDOW_H
static Window & getInstance()
Returns an instance of the Window class.
Definition Window.cpp:10
void close()
Close the window and destroy all the attached resources.
Definition Window.cpp:38
void clear()
Clear the window.
Definition Window.cpp:30
Window(Window &other)=delete
bool isOpen() const
Tell whether the window is open.
Definition Window.cpp:18
bool pollEvent(sf::Event &event)
Pop the event on top of the event queue, if any, and return it.
Definition Window.cpp:22
void operator=(const Window &)=delete
unsigned int getHeight() const
Get the height of the rendering region of the window. This does not include the titlebar or borders o...
Definition Window.cpp:50
unsigned int getWidth() const
Get the width of the rendering region of the window. This does not include the borders of the window.
Definition Window.cpp:46
void setFramerateLimit(unsigned int frameRate)
Limit the framerate to a maximum fixed frequency.
Definition Window.cpp:42
void setView(const sf::View &view)
Change the current active view.
Definition Window.cpp:54
void draw(const sf::Drawable &drawable)
Draw a drawable object to the window.
Definition Window.cpp:26
void display()
Display on screen what has been drawn to the window since the last clear.
Definition Window.cpp:34