mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 07:47:42 +00:00
Initial work on entity introspection
This commit is contained in:
36
Runtime/ImGuiEntitySupport.cpp
Normal file
36
Runtime/ImGuiEntitySupport.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "Runtime/World/CEntity.hpp"
|
||||
#include "Runtime/World/CActor.hpp"
|
||||
#include "Runtime/World/CAi.hpp"
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
#include "Runtime/World/CPlayer.hpp"
|
||||
|
||||
#include "imgui.h"
|
||||
|
||||
#define IMGUI_ENTITY_INSPECT(CLS, PARENT, NAME, BLOCK) \
|
||||
std::string_view CLS::ImGuiType() { return #NAME; } \
|
||||
void CLS::ImGuiInspect() { \
|
||||
PARENT::ImGuiInspect(); \
|
||||
if (ImGui::CollapsingHeader(#NAME)) \
|
||||
BLOCK \
|
||||
}
|
||||
|
||||
namespace metaforce {
|
||||
std::string_view CEntity::ImGuiType() { return "Entity"; }
|
||||
|
||||
void CEntity::ImGuiInspect() {
|
||||
if (ImGui::CollapsingHeader("Entity", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
ImGui::Text("ID: %x", x8_uid.Value());
|
||||
ImGui::Text("Name: %s", x10_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
IMGUI_ENTITY_INSPECT(CActor, CEntity, Actor, {
|
||||
const zeus::CVector3f& pos = GetTranslation();
|
||||
ImGui::Text("Position: %f, %f, %f", pos.x(), pos.y(), pos.z());
|
||||
})
|
||||
IMGUI_ENTITY_INSPECT(CPhysicsActor, CActor, Physics Actor, {})
|
||||
IMGUI_ENTITY_INSPECT(CAi, CPhysicsActor, AI, {})
|
||||
IMGUI_ENTITY_INSPECT(CPatterned, CAi, Patterned, {})
|
||||
|
||||
IMGUI_ENTITY_INSPECT(CPlayer, CPhysicsActor, Player, {})
|
||||
} // namespace metaforce
|
||||
Reference in New Issue
Block a user