|
QuasarEngine
Cross-platform 3D engine and editor
|
Application window. More...
#include <quasar/core/Window.h>
Public Types | |
| using | EventCallback = std::function<void(Event&)> |
| Function that receives the events of the window. | |
Public Member Functions | |
| Window (const Window &)=delete | |
| Window & | operator= (const Window &)=delete |
| Window (Window &&)=delete | |
| Window & | operator= (Window &&)=delete |
| void | Update () |
| Shows the rendered image and processes the messages of the operating system. | |
| void | SetEventCallback (EventCallback callback) |
| Sets the function that receives every event of the window. | |
| bool | ShouldClose () const |
| Returns true when the window was asked to close, by the user or by Close(). | |
| void | Close () |
| Asks the window to close. ShouldClose() then returns true. | |
| void | SetVSync (bool enabled) |
| Enables or disables vertical synchronization. | |
| bool | IsVSync () const |
| Returns true if vertical synchronization is enabled. | |
| std::uint32_t | GetWidth () const |
| Returns the width of the drawing area, in pixels. | |
| std::uint32_t | GetHeight () const |
| Returns the height of the drawing area, in pixels. | |
| const std::string & | GetTitle () const |
| Returns the title of the window. | |
| GLFWwindow * | GetNativeWindow () const |
| Returns the GLFW window, for the code that needs to call GLFW directly. | |
| std::string | GetKeyName (Key key) const |
| Returns the name of a key in the current keyboard layout, for example "z" for Key::W on AZERTY. | |
Static Public Member Functions | |
| static Scope< Window > | Create (const WindowSpecification &specification) |
| Creates a window and shows it. | |
Application window.
A window is created with Create() and destroyed with its Scope. GLFW is initialized with the first window and shut down with the last one.
|
staticnodiscard |
Creates a window and shows it.
| specification | Title, size and settings of the window. |
| void Quasar::Window::Update | ( | ) |
Shows the rendered image and processes the messages of the operating system.
Call it once per frame, after rendering.
| void Quasar::Window::SetVSync | ( | bool | enabled | ) |
Enables or disables vertical synchronization.
With VSync, the frame rate follows the refresh rate of the monitor, which prevents tearing.
| std::string Quasar::Window::GetKeyName | ( | Key | key | ) | const |
Returns the name of a key in the current keyboard layout, for example "z" for Key::W on AZERTY.