libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
GuiElement.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
5
6namespace Ship {
34class GuiElement : public Component {
35 public:
41 GuiElement(const std::string& name, bool isVisible);
42
46 GuiElement(const std::string& name);
47 virtual ~GuiElement();
48
55 virtual void Draw() = 0;
56
62 void Update();
63
65 void Show();
66
68 void Hide();
69
72
74 bool IsVisible();
75
83 virtual void DrawElement() = 0;
84
85 protected:
93 void OnInit(const nlohmann::json& initArgs = nlohmann::json::object()) override;
94
96 virtual void UpdateElement() = 0;
97
106 virtual void SetVisibility(bool visible);
107
109};
110
111} // namespace Ship
A named Part with a parent/child hierarchy and optional thread safety.
Definition Component.h:34
Abstract base class for all visible GUI elements (windows, menu bars, overlays).
Definition GuiElement.h:34
bool IsVisible()
Returns true if the element is currently visible.
void OnInit(const nlohmann::json &initArgs=nlohmann::json::object()) override
Component initialization hook.
bool mIsVisible
Current visibility state. Subclasses may read this directly.
Definition GuiElement.h:108
GuiElement(const std::string &name)
Constructs a GuiElement that starts hidden.
virtual void DrawElement()=0
Renders the element's content (pure ImGui draw calls).
GuiElement(const std::string &name, bool isVisible)
Constructs a GuiElement with an explicit initial visibility.
virtual void UpdateElement()=0
Per-frame logic update called by Update(). Subclasses perform state updates here.
void Hide()
Hides the element (equivalent to SetVisibility(false)).
void Update()
Updates element state for the current frame (called before Draw).
virtual ~GuiElement()
virtual void Draw()=0
Renders the element for the current frame.
void ToggleVisibility()
Flips the visibility state between shown and hidden.
void Show()
Makes the element visible (equivalent to SetVisibility(true)).
virtual void SetVisibility(bool visible)
Changes the visibility flag and optionally persists it to a CVar.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14