-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwindowbackend.hpp
More file actions
120 lines (119 loc) · 5.03 KB
/
windowbackend.hpp
File metadata and controls
120 lines (119 loc) · 5.03 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
120
#pragma once
#include <fea/config.hpp>
#include <fea/ui/videomode.hpp>
#include <fea/ui/windowstyle.hpp>
#include <fea/ui/contextsettings.hpp>
#include <fea/ui/vec2i.hpp>
#include <string>
namespace fea
{
class FEA_API WindowBackend
{
public:
virtual void open(VideoMode mode, const std::string& title, uint32_t style=Style::Default, const ContextSettings& settings=ContextSettings()) = 0;
virtual void close() = 0;
virtual bool isOpen() const = 0;
virtual const ContextSettings getSettings() const = 0;
virtual Vec2I getPosition() const = 0;
virtual void setPosition(int32_t x, int32_t y) = 0;
virtual Vec2I getSize() const = 0;
virtual void setSize (int32_t w, int32_t h) = 0;
virtual void setTitle(const std::string& title) = 0;
virtual void setIcon(uint32_t width, uint32_t height, const uint8_t* pixels) = 0;
virtual void setVisible(bool visible) = 0;
virtual void setVSyncEnabled(bool enabled) = 0;
virtual void setMouseCursorVisible(bool visible) = 0;
virtual void setFramerateLimit(uint32_t limit) = 0;
virtual bool setRenderingActive(bool active=true) const = 0;
virtual void swapBuffers() = 0;
virtual void lockCursor(bool lock) = 0;
virtual ~WindowBackend(){};
};
/** @addtogroup UserInterface
*@{
* @class WindowBackend
*@}
***
* @class WindowBackend
* @brief Abstract base class for implementing varous Window backends.
***
* @fn void WindowBackend::open(VideoMode mode, const std::string& title, uint32_t style=Style::Default, const ContextSettings& settings=ContextSettings())
* @brief Open a window
*
* This opens the window with the given settings.
* @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 void WindowBackend::close()
* @brief Close the window.
***
* @fn bool WindowBackend::isOpen() const
* @brief Check if the window is currently open.
* @return True if the window is open, otherwise false.
***
* @fn const ContextSettings WindowBackend::getSettings() const
* @brief Access the OpenGL settings of the Window.
* @return Struct containing the settings.
***
* @fn Vec2I WindowBackend::getPosition() const
* @brief Get the current position of the Window on the screen.
* @return Vector with the x and y coordinates.
***
* @fn void WindowBackend::setPosition(int32_t x, int32_t y)
* @brief Set the Window position on the screen.
* @param x X coordinate to set the window position to.
* @param y Y coordinate to set the window position to.
***
* @fn Vec2I WindowBackend::getSize() const
* @brief Get the current size of the Window.
* @return Vector with the width and height of the Window.
***
* @fn void WindowBackend::setSize(int32_t w, int32_t h)
* @brief Set the current size of the Window.
* @param w Width.
* @param h Height.
***
* @fn void WindowBackend::setTitle(const std::string& title)
* @brief Set the title name of the window.
* @param title Name to set.
***
* @fn void WindowBackend::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 WindowBackend::setVisible(bool visible)
* @brief Set visibility of the Window.
* @param visible Visibility to set. True is visible and false is hidden.
***
* @fn void WindowBackend::setVSyncEnabled(bool enabled)
* @brief Enable or disable VSync.
* @param enabled True for on, false for off.
***
* @fn void WindowBackend::setMouseCursorVisible(bool visible)
* @brief Toggle visibility of the mouse cursor.
* @param visible True for on, false for off.
***
* @fn void WindowBackend::setFramerateLimit(uint32_t limit)
* @brief Set the framerate limit of the Window.
* @param limit Limit to set in Hertz.
***
* @fn bool WindowBackend::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 WindowBackend::swapBuffers()
* @brief Swaps the front and back buffers, causing what has been rendered on the Window so far to be displayed.
***
* @fn virtual WindowBackend::~WindowBackend()
* @brief Destructor.
***
* @fn void WindowBackend::lockCursor(bool lock)
* @brief Clips the cursor to the window bounds.
* @param lock wether or not to lock.
***/
}