class final
#include <engine/imgui/inspector.hpp>
ImGuiInspector System argument which allows the user to show or edit any reflectable value through ImGui.
Public types
- struct State
- Resource which holds the internal inspector state.
- enum class HookResult { Shown, Modified, Unhandled }
- Possible outputs of a hook function.
-
using Hook = core::
memory:: Function<HookResult(const std::string&, bool, ImGuiInspector&, const core:: reflection:: Type&, void*)> - Function type for general inspector hooks.
-
template<typename T>using TypedHook = core::
memory:: Function<HookResult(const std::string&, bool, ImGuiInspector, T&)> - Function type for specific inspector hooks.
Constructors, destructors, conversion operators
-
ImGuiInspector(core::
ecs:: World& world, State& state) - Constructs a new inspector argument.
Public functions
-
void show(const std::string& name,
const core::
reflection:: Type& type, const void* value) - Displays a reflectable value on the UI.
-
auto edit(const std::string& name,
const core::
reflection:: Type& type, void* value) -> bool - Displays a reflectable value on the UI and allows modifying it.
-
auto inspect(const std::string& name,
bool readOnly,
const core::
reflection:: Type& type, void* value) -> bool - Displays a reflectable value on the UI and optionally allows modifying it.
-
template<typename T>void show(const std::string& name, const T& value)
- Displays a reflectable value on the UI.
-
template<typename T>auto edit(const std::string& name, T& value) -> bool
- Displays a reflectable value on the UI and allows modifying it.
- void hook(Hook hook)
- Overrides the default inspector UI for any types accepted by the given hook.
-
template<typename T>void hook(TypedHook<T> hook)
- Overrides the default inspector UI for a specific type accepted by the given hook.
-
auto world() -> core::
ecs:: World& - Gets the world the inspector is operating on.
Enum documentation
enum class cubos:: engine:: ImGuiInspector:: HookResult
Possible outputs of a hook function.
Enumerators | |
---|---|
Shown | |
Modified |
Value was not modified, but was handled by the hook. |
Unhandled |
Value was modified by the hook. |
Typedef documentation
using cubos:: engine:: ImGuiInspector:: Hook = core:: memory:: Function<HookResult(const std::string&, bool, ImGuiInspector&, const core:: reflection:: Type&, void*)>
Function type for general inspector hooks.
Receives the value name, whether it is read only, the inspector, the type of the value being inspected, and a pointer to the value.
The passed value may only be modified if the value is not read only and the hook returns HookResult::
template<typename T>
using cubos:: engine:: ImGuiInspector:: TypedHook = core:: memory:: Function<HookResult(const std::string&, bool, ImGuiInspector, T&)>
Function type for specific inspector hooks.
Receives the value name, whether it is read only, the inspector, and a reference to the value. The passed value may only be modified if the value returns HookResult::
Function documentation
cubos:: engine:: ImGuiInspector:: ImGuiInspector(core:: ecs:: World& world,
State& state)
Constructs a new inspector argument.
Parameters | |
---|---|
world | ECS world. |
state | Inspector state. |
void cubos:: engine:: ImGuiInspector:: show(const std::string& name,
const core:: reflection:: Type& type,
const void* value)
Displays a reflectable value on the UI.
Parameters | |
---|---|
name | Name of the value. |
type | Value type. |
value | Pointer to value. |
bool cubos:: engine:: ImGuiInspector:: edit(const std::string& name,
const core:: reflection:: Type& type,
void* value)
Displays a reflectable value on the UI and allows modifying it.
Parameters | |
---|---|
name | Name of the value. |
type | Value type. |
value | Pointer to value. |
Returns | Whether the object was modified. |
bool cubos:: engine:: ImGuiInspector:: inspect(const std::string& name,
bool readOnly,
const core:: reflection:: Type& type,
void* value)
Displays a reflectable value on the UI and optionally allows modifying it.
Parameters | |
---|---|
name | Name of the value. |
readOnly | Whether the value is read only. |
type | Value type. |
value | Pointer to value. |
Returns | Whether the object was modified. |
template<typename T>
void cubos:: engine:: ImGuiInspector:: show(const std::string& name,
const T& value)
Displays a reflectable value on the UI.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
name | Name of the value. |
value | Pointer to value. |
template<typename T>
bool cubos:: engine:: ImGuiInspector:: edit(const std::string& name,
T& value)
Displays a reflectable value on the UI and allows modifying it.
Template parameters | |
---|---|
T | Value type. |
Parameters | |
name | Name of the value. |
value | Pointer to value. |
Returns | Whether the object was modified. |