Window that can serve as a target for 2D drawing.
More...
#include <Window.h>
Window that can serve as a target for 2D drawing.
Definition at line 49 of file Window.h.
◆ Style
Window styles.
Enumerator |
---|
None | No border / title bar (this flag and all others are mutually exclusive)
|
Titlebar | Title bar + fixed border.
|
Resize | Title bar + resizable border + maximize button.
|
Close | Title bar + close button.
|
Fullscreen | Fullscreen mode.
|
Default | Default window style.
|
Definition at line 54 of file Window.h.
◆ Window() [1/2]
Constructor.
- Warning
- Only a single instance of the class can exist at a time. Attempting to instantiate the class while there is an active instance will terminate the program
◆ Window() [2/2]
ime::Window::Window |
( |
Window && |
| ) |
|
|
delete |
◆ ~Window()
Destructor.
Ensures a new Window instance can be created when an existing Window instance is destroyed
◆ clear()
Clear the entire window with a single colour.
- Parameters
-
colour | Colour to clear window with |
◆ close()
void ime::Window::close |
( |
| ) |
|
◆ create()
void ime::Window::create |
( |
const std::string & |
title, |
|
|
unsigned int |
width, |
|
|
unsigned int |
height, |
|
|
Style |
style = Style::Default |
|
) |
| |
Create a render window.
- Parameters
-
title | Title of the window |
width | Width of the window |
height | Height of the window |
style | Style of the window |
The dimensions of the window must be positive, otherwise the program will be terminated prematurely
◆ display()
void ime::Window::display |
( |
| ) |
|
Display drawn objects on the window.
◆ draw()
void ime::Window::draw |
( |
const Drawable & |
drawable | ) |
|
Draw drawable on the window.
- Parameters
-
◆ getFramerateLimit()
unsigned int ime::Window::getFramerateLimit |
( |
| ) |
const |
Get the frame rate limit of the window.
- Returns
- The frame rate limit if it has been set, otherwise -1 if the frame rate is not limited
◆ getSize()
Get the dimensions of the window.
- Returns
- Dimensions of the window
◆ isOpen()
bool ime::Window::isOpen |
( |
| ) |
const |
Check if the window is open or not.
- Returns
- true if open, false if not open
◆ operator=()
Move assignment operator.
◆ setFramerateLimit()
void ime::Window::setFramerateLimit |
( |
unsigned int |
framerateLimit | ) |
|
Set the frame rate limit of the window.
- Parameters
-
framerateLimit | Frame rate limit |
The frame rate is not limited by default. If set, it can be disabled by providing 0 as the argument
◆ setIcon()
void ime::Window::setIcon |
( |
const std::string & |
filename | ) |
|
Change the window's icon.
- Parameters
-
filename | Filename of the window icon to set |
The OS default icon is used by default
◆ setVsyncEnabled()
void ime::Window::setVsyncEnabled |
( |
bool |
isVsyncEnabled | ) |
|
Enable or disable vertical synchronization.
- Parameters
-
isVsyncEnabled | True to enable Vsync or false to disable it |
Activating vertical synchronization will limit the number of frames displayed to the refresh rate of the monitor. This can avoid some visual artifacts, and limit the framerate to a good value (but not constant across different computers).
Vertical synchronization is disabled by default.
The documentation for this class was generated from the following file: