Files

41 lines
1.4 KiB
C++

#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;
void Reflect(FieldVisitor& v) 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