Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::editor::gui::EditorWindow Class Reference

Initializes GLFW + GL + ImGui when constructed, tears everything down in the destructor. One instance per process — ImGui's global state means we can't easily have two at once. More...

#include "donner/editor/gui/EditorWindow.h"

Public Member Functions

 EditorWindow (EditorWindowOptions options={})
 EditorWindow (const EditorWindow &)=delete
EditorWindow & operator= (const EditorWindow &)=delete
bool valid () const
 True iff GLFW + GL + ImGui initialized successfully. Callers should bail out if this is false instead of trying to render.
bool shouldClose () const
 True when the user has clicked the window close button or pressed the OS's "close" shortcut.
void pollEvents ()
 Pumps the OS event queue without blocking. Use on Emscripten (where waitEvents is unimplemented) or when a continuous render loop is required (e.g. when an active animation is driving a fresh frame every tick).
void waitEvents ()
 Blocks until an OS or user-posted event arrives, then pumps the event queue once. This is the on-demand render path: the UI thread sleeps when the editor is idle and wakes on user input, window resize, or an explicit wakeEventLoop() from another thread.
void wakeEventLoop ()
 Post an empty event into the window's queue, waking a concurrent waitEvents() call. Safe to call from any thread. Used by the async renderer worker to wake the UI thread when a render result becomes available.
void beginFrame ()
 Starts a new ImGui frame. Caller issues ImGui::* widget calls after this returns.
void endFrame ()
 Flushes the current ImGui frame to the backbuffer, clears with the configured color, and swaps. Must be called once per beginFrame().
void uploadBitmap (const svg::RendererBitmap &bitmap)
 Uploads bitmap to the GL texture owned by this window. The texture is reused across calls — later calls replace the contents. No-op on empty bitmaps. After upload, textureId() returns a handle suitable for ImGui::Image((void*)(intptr_t)textureId(), ...).
uint32_t textureId () const
 Raw GL texture name for the most recent bitmap upload. Zero when no upload has happened yet.
int textureWidth () const
 Dimensions of the most recently uploaded bitmap. (0, 0) before the first upload.
int textureHeight () const
void setTitle (std::string_view title)
 Update the native window title.
Vector2i windowSize () const
 Logical window size in screen coordinates.
Vector2d contentScale () const
 Backing display content scale (for example 2.0 on a Retina display).
double displayScale () const
 Effective UI display scale used for ImGui fonts and framebuffer coordinates.
void setUserPointer (void *pointer)
 Install a GLFW user pointer on the wrapped window.
GLFWscrollfun setScrollCallback (GLFWscrollfun callback)
 Replace the GLFW scroll callback, returning the previous callback.
GLFWwindow * rawHandle () const
 Raw GLFW window handle. Exposed for advanced use cases (custom key bindings, drag-and-drop setup). The main MVP binary doesn't need it.

Detailed Description

Initializes GLFW + GL + ImGui when constructed, tears everything down in the destructor. One instance per process — ImGui's global state means we can't easily have two at once.

Member Function Documentation

◆ waitEvents()

void donner::editor::gui::EditorWindow::waitEvents ( )

Blocks until an OS or user-posted event arrives, then pumps the event queue once. This is the on-demand render path: the UI thread sleeps when the editor is idle and wakes on user input, window resize, or an explicit wakeEventLoop() from another thread.

No-op on Emscripten, where the browser's requestAnimationFrame drives the main loop instead (glfwWaitEvents is unimplemented upstream).

◆ wakeEventLoop()

void donner::editor::gui::EditorWindow::wakeEventLoop ( )

Post an empty event into the window's queue, waking a concurrent waitEvents() call. Safe to call from any thread. Used by the async renderer worker to wake the UI thread when a render result becomes available.

No-op on Emscripten.


The documentation for this class was generated from the following file: