feat: add basic canvas / improve inspector

This commit is contained in:
2026-10-18 20:42:04 +02:00
parent 7df65f52b5
commit ad16daea7c
47 changed files with 3142 additions and 405 deletions
@@ -0,0 +1,43 @@
#ifndef LIGHTKEEPER_CROSSHAIRUI_H
#define LIGHTKEEPER_CROSSHAIRUI_H
#include <glm/glm.hpp>
#include <destrum/ObjectModel/Component.h>
#include <destrum/ObjectModel/ObjectRef.h>
// Shows the crosshair while the player is possessed, tints and grows it and shows the focus
// indicator while the player looks at an Interactable
class CrosshairUI final : public Component {
public:
explicit CrosshairUI(GameObject& parent);
std::string GetTypeName() const override { return "CrosshairUI"; }
void LateUpdate(float dt) override;
nlohmann::json Serialize() const override;
void Deserialize(const nlohmann::json& data) override;
void ResolveReferences(const ObjectMap& objects) override;
void ImGuiInspector() override;
void SetPlayer(const GameObject& player) { m_Player = ObjectRef(player); }
void SetCrosshair(const GameObject& crosshair) { m_Crosshair = ObjectRef(crosshair); }
void SetFocusIndicator(const GameObject& indicator) { m_FocusIndicator = ObjectRef(indicator); }
[[nodiscard]] const ObjectRef& GetPlayer() const { return m_Player; }
[[nodiscard]] const ObjectRef& GetCrosshair() const { return m_Crosshair; }
[[nodiscard]] const ObjectRef& GetFocusIndicator() const { return m_FocusIndicator; }
private:
ObjectRef m_Player;
ObjectRef m_Crosshair;
ObjectRef m_FocusIndicator;
glm::vec4 m_Color{1.0f, 1.0f, 1.0f, 0.8f};
glm::vec4 m_FocusedColor{1.0f, 0.8f, 0.25f, 1.0f};
float m_Size{10.0f};
float m_FocusedSize{16.0f};
};
#endif // LIGHTKEEPER_CROSSHAIRUI_H