9#ifndef AVARA3D_RENDER_CONTEXT_GLFWWINDOW_H
10#define AVARA3D_RENDER_CONTEXT_GLFWWINDOW_H
15#include "a3d/render/context/RenderContext.h"
23 class DesktopInputContext;
57 bool enableHighDPI =
true,
145 void pollEvents()
override;
147 void beginFrame(
const Scene& scene)
override;
148 void endFrame(
const Scene& scene)
override;
150 void swapBuffers()
override;
155 unsigned defaultFramebuffer()
const override;
160 GLFWwindow* glfwWindow()
const;
164 static void Destroy(GLFWwindow* window);
169 static void GLFWCursorPositionCallback(GLFWwindow* glfwWindow,
double xPos,
double yPos);
170 static void GLFWMouseButtonCallback(GLFWwindow* glfwWindow,
int button,
int action,
int mods);
171 static void GLFWScrollWheelCallback(GLFWwindow* glfwWindow,
double xOffset,
double yOffset);
172 static void GLFWKeyCallback(GLFWwindow* glfwWindow,
int key,
int scanCode,
int action,
int mods);
173 static void GLFWWindowFocusCallback(GLFWwindow* glfwWindow,
int focused);
174 static Window* WindowFromGLFWwindow(GLFWwindow* glfwWindow);
179 void registerGLFWCallbacks();
180 void unregisterGLFWCallbacks();
184 struct DestroyGLFWWindow {
185 void operator()(GLFWwindow* window) {
192 std::unique_ptr<GLFWwindow, DestroyGLFWWindow> _glfwWindow;
194 bool _cursorCaptured;
198 bool _highDPIEnabled;
199 DesktopInputContext* _inputContext;
Exposes keyboard, pointer-button, pointer-motion, and scroll state.
Abstract rendering destination used by VisualWorld.
Antialiasing antialiasing() const
Returns the antialiasing mode selected when the rendering target was created.
Antialiasing
Selects multisample antialiasing requested for the rendering target.
@ None
No multisample antialiasing.
Owns a scene graph and the worlds used to simulate and render it.
RenderContext for interactive desktop and web rendering.
Window(const math::uvec2 &size, bool fullScreen, bool enableHighDPI=true, Antialiasing antialiasing=Antialiasing::None)
Creates a rendering window and its rendering resources.
bool cursorHidden() const
Returns whether the pointer is requested to be hidden when not captured.
void open()
Shows the window and begins accepting normal window callbacks.
void hidden(bool hidden)
Shows or hides the window.
void title(const std::string &title)
Sets the window title.
void cursorHidden(bool hidden)
Shows or hides the pointer when pointer capture is disabled.
bool cursorCaptured() const
Returns whether pointer input is captured by the window.
bool hidden() const
Returns whether the window is explicitly hidden.
void vSyncEnabled(bool enabled) override
Enables or disables vertical synchronization when supported.
void center()
Centers the window on its current monitor when supported by the platform.
void position(const math::uvec2 &pos)
Sets the window position in screen coordinates.
static std::unique_ptr< DesktopInputContext > InputContext()
Creates the DesktopInputContext implementation used by Window.
bool isOpen() const
Returns whether the Window has been opened and not subsequently closed.
std::string title() const
Returns the window title; web builds currently return an empty string.
math::uvec2 size() const
Returns the window size in platform window coordinates.
void cursorCaptured(bool captured)
Captures or releases pointer input.
bool vSyncEnabled() const override
Returns whether vertical synchronization is enabled.
math::uvec2 position() const
Returns the window position in screen coordinates.
void size(const math::uvec2 &size)
Sets the window size in platform window coordinates.
void close()
Closes the window and releases pointer capture.
bool highDPIEnabled() const
Returns whether high-DPI rendering was requested when the Window was created.