GLFWWindow Class
An OpenGL focused window implementation using GLFW. More...
Declaration
Base class
| class | Window |
|
Abstract base class representing a generic window. More... | |
Public Constructors Index
| GLFWWindow (const GLFWWindow &)=delete | |
|
Do not copy instances of GLFWWindow. More... | |
| GLFWWindow (std::unique_ptr< helios::rendering::RenderTarget > renderTarget, const GLFWWindowConfig &cfg) | |
|
Constructs a new GLFWWindow based in the provided configuration. The underlying native window is not created until show() is called. More... | |
Public Destructor Index
| ~GLFWWindow () override | |
Public Operators Index
| GLFWWindow & | operator= (const GLFWWindow &)=delete |
Public Member Functions Index
| bool | show () noexcept override |
|
Creates and displays the underlying native `GlFWwindow`. More... | |
| void | swapBuffers () const noexcept override |
|
Swaps the front and back buffers of the window. More... | |
| void | pollEvents () const noexcept override |
|
Processes all events in the underlying Window's EventQueue. More... | |
| void | setShouldClose (bool close) override |
|
Sets the close flag of this window. More... | |
| bool | shouldClose () const override |
|
Checks if the window has received a close request. More... | |
| GLFWframebuffersizefun | frameBufferSizeCallback () const noexcept |
|
Returns the framebuffer resize callback function. More... | |
| void | setFrameBufferSizeCallback (GLFWframebuffersizefun framebufferSizeCallback) noexcept |
|
Sets the callback function for framebuffer resize events. More... | |
| GLFWwindow * | nativeHandle () const noexcept |
|
Returns the raw native GLFWwindow handle. More... | |
| void | destroy () const |
|
Removed the underlying native handle of the GLFWwindow. More... | |
| void | setWindowUserPointer (std::unique_ptr< GLFWWindowUserPointer > windowUserPointer) noexcept |
|
Sets the user-defined pointer for his GLFWWindow. More... | |
| const GLFWWindowUserPointer & | windowUserPointer () const noexcept |
|
Returns a const reference to the `GLFWWindowUserPointer` managed by this class. More... | |
Private Member Attributes Index
| GLFWwindow * | nativeHandle_ = nullptr |
|
The native GLFWwindow handle. More... | |
| GLFWframebuffersizefun | frameBufferSizeCallback_ |
|
C-style callback function for framebuffer resize events. This function pointer is passed to `glfwSetFramebufferSizeCallback`. More... | |
| std::unique_ptr< GLFWWindowUserPointer > | windowUserPointer_ |
|
A unique_ptr to the to an object holding user defined data for the native GLFWwindow. This information gets forwarded using `glfwSetWindowUserPointer`. More... | |
Description
An OpenGL focused window implementation using GLFW.
This class manages a `GLFWwindow` handle, providing methods for creation, display, event polling and resource cleanup.
- Todo
-
add glfwSetWindowRefreshCallback
Definition at line 29 of file GLFWWindow.ixx.
Public Constructors
GLFWWindow()
| delete |
Do not copy instances of GLFWWindow.
Definition at line 54 of file GLFWWindow.ixx.
Reference GLFWWindow.
Referenced by GLFWWindow and operator=.
GLFWWindow()
| inline explicit |
Constructs a new GLFWWindow based in the provided configuration. The underlying native window is not created until show() is called.
- Parameters
-
cfg A const ref to this window's configuration-
Definition at line 71 of file GLFWWindow.ixx.
References frameBufferSizeCallback, helios::window::Window::renderTarget and helios::window::Window::Window.
Public Destructor
~GLFWWindow()
| inline |
Destructor. Delegates to destroy().
Definition at line 60 of file GLFWWindow.ixx.
Reference destroy.
Public Operators
operator=()
| delete |
Definition at line 55 of file GLFWWindow.ixx.
Reference GLFWWindow.
Public Member Functions
destroy()
| inline |
Removed the underlying native handle of the GLFWwindow.
Definition at line 204 of file GLFWWindow.ixx.
Referenced by ~GLFWWindow.
frameBufferSizeCallback()
| inline nodiscard noexcept |
Returns the framebuffer resize callback function.
- Returns
the `GLFWframebuffersizefun` currently registered with this Window.
Definition at line 167 of file GLFWWindow.ixx.
Referenced by GLFWWindow.
nativeHandle()
| inline nodiscard noexcept |
Returns the raw native GLFWwindow handle.
This method should only be used in GLFW-related API parts, where underlying glfw-functions require the native window handle.
- Returns
The `GLFWwindow*` handle, or a `nullptr` if not available.
Definition at line 194 of file GLFWWindow.ixx.
pollEvents()
| inline noexcept virtual |
Processes all events in the underlying Window's EventQueue.
This method should be called regularly in the main loop.
Definition at line 131 of file GLFWWindow.ixx.
setFrameBufferSizeCallback()
| inline noexcept |
Sets the callback function for framebuffer resize events.
Implementing APIs should consider this method as "package protected": It's purpose is to register a function that delegates the native event into the Application's EventQueue.
- Parameters
-
framebufferSizeCallback The `GLFWframebuffersizefun` to set.
Definition at line 181 of file GLFWWindow.ixx.
setShouldClose()
| inline virtual |
Sets the close flag of this window.
- Parameters
-
close True to indicate this window should be closed, false otherwise.
- See Also
Definition at line 141 of file GLFWWindow.ixx.
setWindowUserPointer()
| inline noexcept |
Sets the user-defined pointer for his GLFWWindow.
This transfers ownership of the `GLFWWindowUserPointer`-object to this Window and additionally associates its raw pointer with this Window's native handle.
- Parameters
-
windowUserPointer A unique_ptr to the `GLFWWindowUserPointer` object. Ownership is transferred to this Window-instance.
- Returns
Definition at line 222 of file GLFWWindow.ixx.
Reference windowUserPointer.
Referenced by helios::ext::glfw::app::GLFWFactory::makeOpenGLApp.
shouldClose()
| inline nodiscard virtual |
Checks if the window has received a close request.
Implementing APIs should consider this flag at regular intervals (e.g. each frame) to determine whether this window should be closed.
- Returns
true if the window should be closed, otherwise false.
- See Also
Definition at line 151 of file GLFWWindow.ixx.
show()
| inline noexcept virtual |
Creates and displays the underlying native `GlFWwindow`.
This method initializes the native window. It does not set the current context, which is actually done by GLFWApplication::setCurrent().
Definition at line 91 of file GLFWWindow.ixx.
References helios::window::Window::aspectRatioDenom_, helios::window::Window::aspectRatioNumer_, helios::window::Window::height_, helios::window::Window::logger_, helios::window::Window::title_ and helios::window::Window::width_.
swapBuffers()
| inline noexcept virtual |
Swaps the front and back buffers of the window.
Definition at line 119 of file GLFWWindow.ixx.
windowUserPointer()
| inline nodiscard noexcept |
Returns a const reference to the `GLFWWindowUserPointer` managed by this class.
- Returns
A const reference to this object's `GLFWWindowUserPointer`.
Definition at line 233 of file GLFWWindow.ixx.
Referenced by setWindowUserPointer.
Private Member Attributes
frameBufferSizeCallback_
|
C-style callback function for framebuffer resize events. This function pointer is passed to `glfwSetFramebufferSizeCallback`.
Definition at line 42 of file GLFWWindow.ixx.
nativeHandle_
|
The native GLFWwindow handle.
Definition at line 35 of file GLFWWindow.ixx.
windowUserPointer_
|
A unique_ptr to the to an object holding user defined data for the native GLFWwindow. This information gets forwarded using `glfwSetWindowUserPointer`.
Definition at line 48 of file GLFWWindow.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.