|
FuncDoodle
|
Abstraction over a GLFW window with input, rendering, and lifecycle utilities. More...
#include <Window.h>
Public Types | |
| using | DropCallback = std::function<void(Window*, int, const char**)> |
| Callback type invoked for file-drop events. | |
| using | ErrorCallback = void (*)(int err, const char* desc) |
| Callback type invoked for GLFW errors. | |
| using | CloseCallback = std::function<void(Window*)> |
| Callback type invoked when the window is asked to close. | |
Public Member Functions | |
| Window (WindowSpec spec) | |
| Creates a window from an initial specification. | |
| ~Window () | |
| void | SetTitle (const char *title) |
| Sets the window title. | |
| void | SetIcon (std::filesystem::path icon) |
| Sets the window icon from a file path. | |
| void | SetDropCallback (DropCallback cb) |
| Sets callback for file drop events. | |
| void | SetCloseCallback (CloseCallback cb) |
| Sets callback for window close events. | |
| void | SetShouldClose (bool shouldClose) |
| Requests the window to close. | |
| bool | ShouldClose () |
| Returns whether the window should close. | |
| void | GetFramebufferSize (int *width, int *height) |
| Retrieves framebuffer size in pixels. | |
| void | SwapBuffers () |
| Swaps front and back buffers. | |
| void | SetCursorHidden (bool hidden) |
| Enables or disables cursor visibility. | |
| bool | GetCursorHidden () const |
| Returns whether the cursor is currently hidden. | |
| void | InitImGui () |
| Initializes ImGui for this window. | |
Static Public Member Functions | |
| static void | SetErrorCallback (ErrorCallback cb) |
| Sets GLFW error callback. | |
| static void | PollEvents () |
| Polls OS and input events. | |
| static void | InitGlfw () |
| Initializes GLFW (must be called once before creating windows). | |
Protected Attributes | |
| DropCallback | mp_DropCallback |
| Stored file-drop callback. | |
| CloseCallback | mp_CloseCallback |
| Stored close callback. | |
Static Private Member Functions | |
| static void | GlfwDropTrampoline (GLFWwindow *glfwWin, int count, const char **paths) |
| static void | GlfwCloseTrampoline (GLFWwindow *glfwWin) |
Private Attributes | |
| GLFWwindow * | m_Handle |
| bool | m_CursorHidden |
| WindowSpec | m_Spec |
| GLFWcursor * | m_BlankCursor = nullptr |
Abstraction over a GLFW window with input, rendering, and lifecycle utilities.
| using FuncDoodle::Platform::Window::CloseCallback = std::function<void(Window*)> |
Callback type invoked when the window is asked to close.
| using FuncDoodle::Platform::Window::DropCallback = std::function<void(Window*, int, const char**)> |
Callback type invoked for file-drop events.
| using FuncDoodle::Platform::Window::ErrorCallback = void (*)(int err, const char* desc) |
Callback type invoked for GLFW errors.
| FuncDoodle::Platform::Window::Window | ( | WindowSpec | spec | ) |
Creates a window from an initial specification.
| spec | Window creation parameters. |
| FuncDoodle::Platform::Window::~Window | ( | ) |
|
inlinenodiscard |
Returns whether the cursor is currently hidden.
| void FuncDoodle::Platform::Window::GetFramebufferSize | ( | int * | width, |
| int * | height ) |
Retrieves framebuffer size in pixels.
|
staticprivate |
|
staticprivate |
|
static |
Initializes GLFW (must be called once before creating windows).
| void FuncDoodle::Platform::Window::InitImGui | ( | ) |
Initializes ImGui for this window.
|
static |
Polls OS and input events.
| void FuncDoodle::Platform::Window::SetCloseCallback | ( | CloseCallback | cb | ) |
Sets callback for window close events.
| void FuncDoodle::Platform::Window::SetCursorHidden | ( | bool | hidden | ) |
Enables or disables cursor visibility.
| void FuncDoodle::Platform::Window::SetDropCallback | ( | DropCallback | cb | ) |
Sets callback for file drop events.
|
static |
Sets GLFW error callback.
| void FuncDoodle::Platform::Window::SetIcon | ( | std::filesystem::path | icon | ) |
Sets the window icon from a file path.
| void FuncDoodle::Platform::Window::SetShouldClose | ( | bool | shouldClose | ) |
Requests the window to close.
| void FuncDoodle::Platform::Window::SetTitle | ( | const char * | title | ) |
Sets the window title.
| bool FuncDoodle::Platform::Window::ShouldClose | ( | ) |
Returns whether the window should close.
| void FuncDoodle::Platform::Window::SwapBuffers | ( | ) |
Swaps front and back buffers.
|
private |
|
private |
|
private |
|
private |
|
protected |
Stored close callback.
|
protected |
Stored file-drop callback.