feat: add imguizmo + trigger buxfix
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <destrum/App.h>
|
||||
#include <destrum/Scene/SceneManager.h>
|
||||
#include <destrum/Graphics/RenderResources.h>
|
||||
#include <destrum/Util/TransformGizmo.h>
|
||||
|
||||
#include "destrum/Graphics/Resources/Cubemap.h"
|
||||
#include "destrum/Graphics/Resources/Font.h"
|
||||
@@ -31,13 +32,17 @@ public:
|
||||
private:
|
||||
void setupSkybox();
|
||||
void drawCrosshair();
|
||||
void drawViewModeHint();
|
||||
void updateViewMode();
|
||||
[[nodiscard]] CameraComponent* getSceneCamera() const;
|
||||
[[nodiscard]] Camera& getViewCamera();
|
||||
[[nodiscard]] bool isPlayerViewActive() const;
|
||||
|
||||
// LightkeeperDebugUi.cpp
|
||||
void updateDebugUi();
|
||||
void drawDebugMenuBar();
|
||||
void drawWindowMenu();
|
||||
void drawSelectionGizmo();
|
||||
void drawTestWindow();
|
||||
void spawnBall();
|
||||
void saveCurrentScene();
|
||||
@@ -54,6 +59,7 @@ private:
|
||||
|
||||
ImageID debug2DTexture{NULL_IMAGE_ID};
|
||||
Font hudFont;
|
||||
TransformGizmo transformGizmo;
|
||||
|
||||
char scenePath[512]{"scenes/debug_scene.json"};
|
||||
char newSceneName[128]{"EmptyScene"};
|
||||
@@ -61,6 +67,7 @@ private:
|
||||
bool renderColliders{false};
|
||||
bool render2DShapes{true};
|
||||
bool renderDebugLines{true};
|
||||
bool showTransformGizmo{true};
|
||||
bool showTestWindow{true};
|
||||
bool useFreeCamera{false};
|
||||
};
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
[[nodiscard]] Interactable* GetFocusedInteractable() const { return m_FocusedInteractable; }
|
||||
[[nodiscard]] glm::vec3 GetLookDirection() const;
|
||||
|
||||
[[nodiscard]] bool IsMouseCaptured() const { return InputManager::GetInstance().IsMouseCaptured(); }
|
||||
void SetMouseCaptured(bool captured);
|
||||
[[nodiscard]] bool IsPossessed() const { return m_Possessed; }
|
||||
void SetPossessed(bool possessed);
|
||||
|
||||
private:
|
||||
[[nodiscard]] bool CheckGrounded() const;
|
||||
@@ -70,6 +70,7 @@ private:
|
||||
|
||||
Interactable* m_FocusedInteractable{nullptr};
|
||||
|
||||
bool m_Possessed{false};
|
||||
bool m_Grounded{false};
|
||||
bool m_JumpHeld{false};
|
||||
float m_CoyoteTimer{0.0f};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <components/Door.h>
|
||||
#include <components/FirstPersonController.h>
|
||||
#include <components/InteractableButton.h>
|
||||
#include <components/LightToggle.h>
|
||||
#include <components/PrintComponent.h>
|
||||
#include <components/TriggerLoggerComponent.h>
|
||||
|
||||
@@ -11,6 +12,7 @@
|
||||
X(Door) \
|
||||
X(FirstPersonController) \
|
||||
X(InteractableButton) \
|
||||
X(LightToggle) \
|
||||
X(PrintComponent) \
|
||||
X(TriggerLoggerComponent)
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ public:
|
||||
[[nodiscard]] std::size_t GetColorIndex() const { return m_ColorIndex; }
|
||||
[[nodiscard]] int GetPressCount() const { return m_PressCount; }
|
||||
|
||||
void SetCycleColors(bool cycleColors) { m_CycleColors = cycleColors; }
|
||||
|
||||
// Every Activatable on a target object is activated when the button is pressed
|
||||
void AddTarget(const GameObject& target);
|
||||
void RemoveTarget(ObjectId target);
|
||||
@@ -36,6 +38,7 @@ private:
|
||||
|
||||
std::size_t m_ColorIndex{0};
|
||||
int m_PressCount{0};
|
||||
bool m_CycleColors{true};
|
||||
std::vector<ObjectId> m_Targets;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef LIGHTKEEPER_LIGHTTOGGLE_H
|
||||
#define LIGHTKEEPER_LIGHTTOGGLE_H
|
||||
|
||||
#include <components/Activatable.h>
|
||||
|
||||
class LightToggle final : public Activatable {
|
||||
public:
|
||||
explicit LightToggle(GameObject& parent);
|
||||
|
||||
std::string GetTypeName() const override { return "LightToggle"; }
|
||||
|
||||
void Start() override;
|
||||
|
||||
nlohmann::json Serialize() const override;
|
||||
void Deserialize(const nlohmann::json& data) override;
|
||||
void ImGuiInspector() override;
|
||||
|
||||
void SetOn(bool on);
|
||||
[[nodiscard]] bool IsOn() const { return m_On; }
|
||||
|
||||
protected:
|
||||
void OnActivate(GameObject& instigator) override;
|
||||
|
||||
private:
|
||||
void Apply();
|
||||
|
||||
bool m_On{true};
|
||||
};
|
||||
|
||||
#endif // LIGHTKEEPER_LIGHTTOGGLE_H
|
||||
Reference in New Issue
Block a user