metaforce/Runtime/ImGuiConsole.hpp

53 lines
1.3 KiB
C++
Raw Normal View History

2021-05-25 16:24:05 +00:00
#pragma once
2021-05-26 16:23:44 +00:00
#include <set>
#include <string_view>
#include "RetroTypes.hpp"
#include "Runtime/World/CEntity.hpp"
#include "Runtime/World/CActor.hpp"
2021-05-26 16:23:44 +00:00
2021-05-25 16:24:05 +00:00
namespace metaforce {
2021-05-26 16:23:44 +00:00
void ImGuiStringViewText(std::string_view text);
struct ImGuiEntityEntry {
TUniqueId uid = kInvalidUniqueId;
CEntity* ent = nullptr;
std::string_view type;
std::string_view name;
bool active = false;
bool isActor = false;
ImGuiEntityEntry() {}
ImGuiEntityEntry(TUniqueId uid, CEntity* ent, std::string_view type, std::string_view name, bool active)
: uid(uid), ent(ent), type(type), name(name), active(active) {}
CActor* AsActor() const {
if (isActor) {
return static_cast<CActor*>(ent);
}
return nullptr;
}
};
2021-05-25 16:24:05 +00:00
class ImGuiConsole {
public:
2021-05-26 16:23:44 +00:00
static std::set<TUniqueId> inspectingEntities;
static std::array<ImGuiEntityEntry, 1024> entities;
2021-05-26 16:23:44 +00:00
2021-05-25 19:58:18 +00:00
~ImGuiConsole();
void PreUpdate();
void PostUpdate();
static void BeginEntityRow(const ImGuiEntityEntry& entry);
static void EndEntityRow(const ImGuiEntityEntry& entry);
private:
static void ShowAppMainMenuBar(bool canInspect);
static bool ShowEntityInfoWindow(TUniqueId uid);
static void ShowInspectWindow(bool* isOpen);
static void LerpDebugColor(CActor* act);
static void UpdateEntityEntries();
2021-05-25 16:24:05 +00:00
};
2021-05-25 19:58:18 +00:00
} // namespace metaforce