Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
EditorWindow.h File Reference

EditorWindow — RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap. More...

#include <cstdint>
#include <string>
#include <string_view>
#include "donner/base/Vector2.h"
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for EditorWindow.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::gui::UiScaleConfig
 HiDPI settings derived from the native window/display scale. More...
struct  donner::editor::gui::EditorWindowOptions
class  donner::editor::gui::EditorWindow
 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...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Typedefs

using GLFWscrollfun = void (*)(GLFWwindow*, double, double)

Functions

UiScaleConfig donner::editor::gui::ComputeUiScaleConfig (int logicalWindowWidth, int framebufferWidth, double contentScaleX)
 Derive the editor's UI scaling from logical window size, framebuffer size, and the platform's content scale hint. Prefers the framebuffer/logical ratio when available.

Detailed Description

EditorWindow — RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap.

The class is intentionally narrow — it exposes only what the main binary needs:

  • construct/destruct (RAII handles cleanup)
  • shouldClose() / pollEvents() — event loop hooks
  • beginFrame() / endFrame() — ImGui frame bracketing + swap
  • uploadBitmap() — moves a CPU-side RGBA buffer into a GL texture (reuses the same texture ID across frames to avoid churn)
  • textureId() — exposes the current texture for ImGui::Image

Any code that wants to draw ImGui widgets happens between beginFrame() and endFrame() on the caller's side — this class doesn't own the widget tree, just the hosting surface.