-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwindow.hpp
More file actions
119 lines (116 loc) · 5.18 KB
/
window.hpp
File metadata and controls
119 lines (116 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#pragma once
#include <fea/config.hpp>
#include <fea/ui/videomode.hpp>
#include <fea/ui/contextsettings.hpp>
#include <fea/ui/windowstyle.hpp>
#include <fea/ui/vec2i.hpp>
#include <string>
#include <memory>
/* from videomode and should be here
static VideoMode getDesktopMode();
static const std::vector<VideoMode>& getFullscreenModes();
bool isValid() const; */
namespace fea
{
class WindowBackend;
class FEA_API Window
{
public:
Window(WindowBackend* windowBackend, VideoMode mode, const std::string& title, uint32_t style = Style::Default, const ContextSettings& settings = ContextSettings());
const ContextSettings getSettings() const;
Vec2I getPosition() const;
void setPosition(int32_t x, int32_t y);
Vec2I getSize() const;
void setSize(int32_t w, int32_t h);
void setTitle(const std::string& title);
void setIcon(uint32_t width, uint32_t height, const uint8_t* pixels);
void setVisible(bool visible);
void setVSyncEnabled(bool enabled);
void setMouseCursorVisible(bool visible);
void setFramerateLimit(uint32_t limit);
bool setRenderingActive(bool active = true) const;
void swapBuffers();
void lockCursor(bool enabled);
private:
std::unique_ptr<WindowBackend> mWindowBackend;
};
/** @addtogroup UserInterface
*@{
* @class Window
*@}
* @class Window
* @brief Class that manages a window instance for the application.
*
* The window can be opened with different settings, including resolution and title. To make the window cross platform and flexible, it needs a backend implementation. This backend could for instance be based on OpenGL, Direct X or even ncurses. Depending on the backend, the window's capabilities and settings may vary.
*
* The API of this class is heavily inspired by the window class of [SFML](http://www.sfml-dev.org/).
***
* @fn Window::Window(WindowBackend* windowBackend, VideoMode mode, const std::string& title, uint32_t style = Style::Default, const ContextSettings& settings = ContextSettings())
* @brief Construct a window using the specified backend and open it with the given parameters.
* @param windowBackend Backend to use with the window instance. Will be stored as an std::unique_ptr and therefore memory will be managed.
* @param mode Video mode to use.
* @param title Desired title bar name.
* @param style Window style to use.
* @param settings OpenGL context settings to use.
***
* @fn const ContextSettings Window::getSettings() const
* @brief Access the OpenGL settings of the Window.
* @return Struct containing the settings.
***
* @fn Vec2I Window::getPosition() const
* @brief Get the current position of the Window on the screen.
* @return Vector with the x and y coordinates.
***
* @fn void Window::setPosition(int32_t x, int32_t y)
* @brief Set the Window position on the screen.
* @param x X coordinate.
* @param y Y coordinate.
***
* @fn Vec2I Window::getSize() const
* @brief Get the current size of the Window.
* @return Vector with the width and height of the Window.
***
* @fn void Window::setSize(int32_t w, int32_t h)
* @brief Set the current size of the Window.
* @param w Width.
* @param h Height.
***
* @fn void Window::setTitle(const std::string& title)
* @brief Set the title name of the window.
* @param title Name to set.
***
* @fn void Window::setIcon(uint32_t width, uint32_t height, const uint8_t* pixels)
* @brief Set the icon of the window.
* @param width Width of the icon.
* @param height Height of the icon.
* @param pixels Array of pixel data of an image to use for the icon.
***
* @fn void Window::setVisible(bool visible)
* @brief Set visibility of the Window.
* @param visible Visibility to set. True is visible and false is hidden.
***
* @fn void Window::setVSyncEnabled(bool enabled)
* @brief Enable or disable VSync.
* @param enabled True for on, false for off.
***
* @fn void Window::setMouseCursorVisible(bool visible)
* @brief Toggle visibility of the mouse cursor.
* @param visible True for on, false for off.
***
* @fn void Window::setFramerateLimit(uint32_t limit)
* @brief Set the framerate limit of the Window.
* @param limit Limit to set in Hertz.
***
* @fn bool Window::setRenderingActive(bool active=true) const
* @brief Toggle this Window as a target for rendering.
* @param active True to set rendering to on, false for off. Default is true.
* @return True if the operation succeeded, otherwise false.
***
* @fn void Window::swapBuffers()
* @brief Swaps the front and back buffers, causing what has been rendered on the Window so far to be displayed.
***
* @fn void Window::lockCursor(bool enabled)
* @brief Locks the cursor to the window.
* @param enabled True to lock, false to unlock.
**/
}