|
Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
|
Runtime ImGui widget that can be rendered into a world-space UI texture. More...
#include <WidgetComponent.h>
Classes | |
| struct | Resolution |
| Requested render-target size for the widget texture. More... | |
| struct | WorldUiWindowStyle |
Public Member Functions | |
| WidgetComponent (Entities::Scene *scene) | |
| Creates a widget component attached to a scene. | |
| void | beginPlay () override |
| Called when the component is added to the scene or the game starts. | |
| void | endPlay () override |
| Called when the component is removed or the game ends. | |
| std::string | getComponentName () const override |
| Gets the component type name for debugging/UI. | |
| Resolution | getRequestedResolution () const |
| Returns the requested offscreen render target resolution. | |
| void | setRequestedResolution (uint32_t width, uint32_t height) |
| Sets the requested offscreen render target resolution. | |
| void | setPixelsPerMeter (float pixelsPerMeter) |
| Sets the density used to map widget pixels onto a 1m x 1m plane. | |
| glm::vec3 | getPlaneScale () const |
| Returns the scale for a unit XZ plane at the requested resolution and pixel density. | |
| bool | isWorldUiActive () const |
| Returns whether this widget should be rendered into world UI. | |
| void | setWorldUiActive (bool active) |
| Enables or disables world UI rendering for this widget. | |
| uint32_t | getWorldUiDescriptorIndex () const |
| Returns the texture descriptor index assigned to this widget. | |
| void | setWorldUiDescriptorIndex (uint32_t descriptorIndex) |
| Stores the texture descriptor index assigned by the world UI renderer. | |
| void | clearWorldUiDescriptorIndex () |
| Clears the assigned world UI texture descriptor index. | |
| void | setWorldUiWindowStyle (WorldUiWindowStyle style) |
| const std::optional< WorldUiWindowStyle > & | getWorldUiWindowStyle () const |
| virtual void | drawRuntimeImGui () |
| Draws this widget's runtime ImGui content into the active ImGui context. | |
| void | requestWorldUiTexture (Assets::Texture2DHandle handle) |
| Makes a loaded engine texture available to this widget's ImGui draw calls. | |
| uint64_t | getWorldUiTextureId (Assets::Texture2DHandle handle) const |
| Returns the ImGui texture ID assigned by the world UI renderer, or zero while loading. | |
| const std::vector< Assets::Texture2DHandle > & | getRequestedWorldUiTextures () const |
| void | setWorldUiTextureId (Assets::Texture2DHandle handle, uint64_t textureId) |
| void | selectNextUpgrade () |
| Selects the next upgrade entry in the demo widget state. | |
| void | selectPreviousUpgrade () |
| Selects the previous upgrade entry in the demo widget state. | |
| void | buySelectedUpgrade () |
| Attempts to purchase the currently selected demo upgrade. | |
| Public Member Functions inherited from Engine::Components::Logic | |
| Logic (Entities::Scene *owningScene) | |
| Constructs a logic component owned by a scene. | |
| Logic (const Entities::SpawnContext &context) | |
| Constructs a logic component from spawn context data. | |
| virtual | ~Logic ()=default |
| Destroys the logic component. | |
| virtual bool | drawImGui () |
| Draws component-specific ImGui inspector controls. | |
| virtual bool | drawImGuiName () |
| Used to alter the name of the entity in the outliner. | |
| virtual void | tick (double deltaTime) |
| Called every frame if ticking is enabled. | |
| bool | hasBegunPlay () const |
| Checks whether beginPlay() has been called without a matching endPlay(). | |
| bool | canTick () const |
| Checks if the component is currently set to tick. | |
| void | setCanTick (bool enable) |
| Enables or disables ticking for this component. | |
| Entities::Entity * | getOwningEntity () const |
| Gets the entity this component belongs to. | |
Static Public Attributes | |
| static constexpr bool | IsUnique = false |
| Widget components are allowed to have multiple instances per entity. | |
| Static Public Attributes inherited from Engine::Components::Logic | |
| static constexpr bool | IsUnique = false |
| Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique =
true; if needed. | |
| static constexpr const char * | ComponentName = "Logic" |
| Fallback component type name. Derived classes may override getComponentName() for custom labels. | |
Private Attributes | |
| Resolution | resolution_ {} |
| float | pixelsPerMeter_ = 750.0f |
| bool | active_ = true |
| uint32_t | descriptorIndex_ = std::numeric_limits<uint32_t>::max() |
| std::optional< WorldUiWindowStyle > | worldUiWindowStyle_ |
| std::vector< Assets::Texture2DHandle > | requestedTextures_ |
| std::unordered_map< uint32_t, uint64_t > | worldUiTextureIds_ |
| int | selectedUpgrade_ = 0 |
| int | credits_ = 120 |
| int | purchaseCount_ = 0 |
Additional Inherited Members | |
| Protected Member Functions inherited from Engine::Components::Logic | |
| Entities::Scene * | getScene () const |
| Gets the scene this component belongs to. | |
| Core::SceneManager * | getSceneManager () const |
| Helper to get the SceneManager from the owning scene. | |
Runtime ImGui widget that can be rendered into a world-space UI texture.
Interaction is driven by gameplay or physical button code mutating this state.
Definition at line 22 of file WidgetComponent.h.
|
explicit |
Creates a widget component attached to a scene.
|
overridevirtual |
Called when the component is added to the scene or the game starts.
Reimplemented from Engine::Components::Logic.
| void Engine::Components::WidgetComponent::buySelectedUpgrade | ( | ) |
Attempts to purchase the currently selected demo upgrade.
| void Engine::Components::WidgetComponent::clearWorldUiDescriptorIndex | ( | ) |
Clears the assigned world UI texture descriptor index.
|
virtual |
Draws this widget's runtime ImGui content into the active ImGui context.
|
overridevirtual |
Called when the component is removed or the game ends.
Reimplemented from Engine::Components::Logic.
|
nodiscardoverridevirtual |
Gets the component type name for debugging/UI.
Reimplemented from Engine::Components::Logic.
|
nodiscard |
Returns the scale for a unit XZ plane at the requested resolution and pixel density.
|
nodiscard |
Returns the requested offscreen render target resolution.
|
nodiscard |
|
nodiscard |
Returns the texture descriptor index assigned to this widget.
|
nodiscard |
Returns the ImGui texture ID assigned by the world UI renderer, or zero while loading.
|
nodiscard |
|
nodiscard |
Returns whether this widget should be rendered into world UI.
| void Engine::Components::WidgetComponent::requestWorldUiTexture | ( | Assets::Texture2DHandle | handle | ) |
Makes a loaded engine texture available to this widget's ImGui draw calls.
| void Engine::Components::WidgetComponent::selectNextUpgrade | ( | ) |
Selects the next upgrade entry in the demo widget state.
| void Engine::Components::WidgetComponent::selectPreviousUpgrade | ( | ) |
Selects the previous upgrade entry in the demo widget state.
| void Engine::Components::WidgetComponent::setPixelsPerMeter | ( | float | pixelsPerMeter | ) |
Sets the density used to map widget pixels onto a 1m x 1m plane.
| void Engine::Components::WidgetComponent::setRequestedResolution | ( | uint32_t | width, |
| uint32_t | height ) |
Sets the requested offscreen render target resolution.
| void Engine::Components::WidgetComponent::setWorldUiActive | ( | bool | active | ) |
Enables or disables world UI rendering for this widget.
| void Engine::Components::WidgetComponent::setWorldUiDescriptorIndex | ( | uint32_t | descriptorIndex | ) |
Stores the texture descriptor index assigned by the world UI renderer.
| void Engine::Components::WidgetComponent::setWorldUiTextureId | ( | Assets::Texture2DHandle | handle, |
| uint64_t | textureId ) |
| void Engine::Components::WidgetComponent::setWorldUiWindowStyle | ( | WorldUiWindowStyle | style | ) |
|
private |
Definition at line 138 of file WidgetComponent.h.
|
private |
Definition at line 145 of file WidgetComponent.h.
|
private |
Definition at line 139 of file WidgetComponent.h.
|
staticconstexpr |
Widget components are allowed to have multiple instances per entity.
Definition at line 42 of file WidgetComponent.h.
|
private |
Definition at line 137 of file WidgetComponent.h.
|
private |
Definition at line 146 of file WidgetComponent.h.
|
private |
Definition at line 141 of file WidgetComponent.h.
|
private |
Definition at line 136 of file WidgetComponent.h.
|
private |
Definition at line 144 of file WidgetComponent.h.
|
private |
Definition at line 142 of file WidgetComponent.h.
|
private |
Definition at line 140 of file WidgetComponent.h.