Harbor

branch main
showing the latest snapshot on main
readme.md 1.4 KB · Markdown
readme.md 0644 Raw

Window

This project aims to be a fully cross-platform library for creating windows. We'll take the best ideas of other libaries and apply them liberally here, while maintaining Odin idioms.

GLFW — great reference for minimalism

Why it’s valuable

  • Very tight scope: windows, input, cursors, monitors, timing
  • Clear separation between windowing and rendering
  • Proven longevity and stability
  • Easy to reason about

Why not copy it directly

  • C-style global state + callbacks
  • Pull-based input querying (glfwGetKey) feels un-Odin
  • Callback soup doesn’t map well to Odin’s structured control flow

What to steal from GLFW:

  • Small, opinionated surface area
  • “We don’t manage your renderer” stance
  • Simple lifecycle rules

If you want something that feels like core:window, GLFW is the right size reference.4

winit — best conceptual model for Odin

Why winit maps well to Odin

  • Event-driven core
  • Explicit event loop ownership
  • Strong separation of:
  • OS events
  • User events
  • Window lifecycle
  • Backend-agnostic (X11, Wayland, Win32, Cocoa, etc.)

Even though it’s Rust, its design philosophy fits Odin extremely well.

  • Structured control flow
  • No hidden globals
  • Deterministic ownership
  • Backend-specific code isolated cleanly

What to adapt (not copy)

  • Central event loop as the spine
  • Typed events instead of callbacks
  • Backend modules per platform
  • Explicit control over blocking vs polling