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...
|
| | EditorWindow (EditorWindowOptions options={}) |
| | Create and initialize a host window with the requested settings.
|
|
| 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 | glUnavailable () const |
| | True when window/context creation failed specifically because the host cannot provide a usable GL context (a headless / GPU-less environment with no software-GL fallback, e.g. GitHub-hosted macOS). Distinct from a generic !valid() so callers can skip GL-dependent work rather than treating it as a hard failure. Only meaningful when valid() is false.
|
|
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 | waitEventsTimeout (double timeoutSeconds) |
| | Blocks until an event arrives or timeoutSeconds elapses, then pumps the event queue once.
|
|
void | pollIdleGpu () |
| | Maintain the GPU contexts owned by this event-loop thread without drawing another frame. The render worker maintains its own context on that worker thread.
|
|
PresentationProgress | pollDeferredPresentation () |
| | Poll deferred GPU work without constructing another UI frame. Called on the window owner.
|
|
bool | hasIdleGpuWork () const |
| | Whether a completion timer should wake this event loop for another cheap idle poll.
|
| 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.
|
|
std::uint64_t | wakeEventLoopRequestSerialForTesting () const |
| | Monotonic count of event-loop wake requests, for bounded scheduling regressions.
|
| bool | hasQueuedInputEvents () const |
| | Whether ImGui is holding input events this thread has accepted but no frame has consumed yet.
|
|
void | beginFrame () |
| | Starts a new ImGui frame. Caller issues ImGui::* widget calls after this returns.
|
|
void | beginFrameWithInput (const EditorWindowInputOverride &inputOverride) |
| | Starts a new ImGui frame after injecting deterministic replay input.
|
|
void | endFrame () |
| | Flushes the current ImGui frame to the backbuffer, clears with the configured color, and swaps. Must be called once per beginFrame().
|
|
svg::RendererBitmap | endFrameAndReadPixels () |
| | Flushes the current ImGui frame, reads the GL backbuffer before swap, then 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 |
| | Return the height of the most recently uploaded bitmap, or zero before the first upload.
|
|
void | setTitle (std::string_view title) |
| | Update the native window title.
|
|
Vector2i | windowSize () const |
| | Logical window size in screen coordinates. An offscreen window returns the logical size of the scale it emulates, which is the size the UI is laid out in. The browser uses the published viewport dimensions shared with canvas sizing, independent of queued GLFW resize delivery.
|
|
Vector2i | framebufferSize () const |
| | Physical framebuffer size in pixels. Equals windowSize scaled by the backing display scale, and matches the dimensions of a bitmap returned by endFrameAndReadPixels. (0, 0) when the window failed to initialize.
|
|
Vector2d | contentScale () const |
| | Backing display content scale (for example 2.0 on a Retina display). An offscreen window returns the scale it emulates instead.
|
|
double | displayScale () const |
| | Effective UI display scale used for ImGui fonts and framebuffer coordinates.
|
|
const EditorWindowFonts & | editorFonts () const |
| | Fonts already installed by an EditorShell sharing this ImGui context.
|
| void | setEditorFonts (EditorWindowFonts fonts) |
| | Remember the editor fonts without changing their ImGui debug names.
|
|
double | lastBeginFrameMs () const |
| | Timing for the most recent beginFrame call.
|
|
const EditorWindowFrameTiming & | lastEndFrameTiming () const |
| | Timing for the most recent completed endFrame call.
|
|
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.
|
|
std::shared_ptr< geode::GeodeDevice > | geodeDevice () const |
| | Shared Geode/WebGPU device for renderer instances in Geode editor builds.
|
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.