From 75fc14f4ac534c6e4456936960cac9e31ba657b5 Mon Sep 17 00:00:00 2001 From: Caleb Burke Date: Thu, 24 Sep 2026 23:00:45 -0700 Subject: [PATCH] handy invalid handle macro --- engine/include/sophia/handles.hpp | 9 +++++++++ examples/boids_2d/main.cpp | 9 +++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/engine/include/sophia/handles.hpp b/engine/include/sophia/handles.hpp index 3a97886..242535f 100644 --- a/engine/include/sophia/handles.hpp +++ b/engine/include/sophia/handles.hpp @@ -24,6 +24,15 @@ struct Handle { [[nodiscard]] auto operator<=>(const Handle&) const = default; }; +struct InvalidHandle { + template + [[nodiscard]] constexpr operator Handle() const { + return Handle::invalid(); + } +}; + +inline constexpr InvalidHandle INVALID_HANDLE{}; + class Mesh; class Panel; class RenderTarget; diff --git a/examples/boids_2d/main.cpp b/examples/boids_2d/main.cpp index 3d723fd..8dcaa57 100644 --- a/examples/boids_2d/main.cpp +++ b/examples/boids_2d/main.cpp @@ -1,6 +1,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -10,12 +13,6 @@ #include #include -#define GLM_FORCE_RADIANS -#define GLM_FORCE_DEPTH_ZERO_TO_ONE -#include -#include -#include - struct Boid { glm::vec2 position; glm::vec2 velocity;