|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
An ImGui window for editing, binding, and testing controller mappings. More...
#include <InputEditorWindow.h>
Public Member Functions | |
| InputEditorWindow (const std::string &consoleVariable, const std::string &name, std::shared_ptr< Ship::ControlDeck > controlDeck, std::shared_ptr< Ship::Window > window) | |
| Constructs an InputEditorWindow with constructor-injected dependencies. | |
| virtual | ~InputEditorWindow () |
| Destroys the InputEditorWindow and releases any active rumble test state. | |
| void | DrawInputChip (const char *buttonName, ImVec4 color) |
Renders a small coloured chip labelled with buttonName. | |
| void | DrawAnalogPreview (const char *label, ImVec2 stick, float deadzone=0, bool gyro=false) |
| Renders a circular analog-stick preview widget. | |
| bool | TestingRumble () |
| Returns true while the rumble test is actively playing. | |
Public Member Functions inherited from Ship::GuiWindow | |
| GuiWindow (std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< Window > window, const std::string &visibilityCvar, bool isVisible, const std::string &name, ImVec2 originalSize, uint32_t windowFlags) | |
| Full constructor with constructor-injected dependencies, explicit size and window flags. | |
| GuiWindow (const std::string &consoleVariable, bool isVisible, const std::string &name, ImVec2 originalSize) | |
| Constructor with explicit size, using default ImGui window flags. | |
| GuiWindow (const std::string &consoleVariable, bool isVisible, const std::string &name, ImVec2 originalSize, uint32_t windowFlags) | |
| GuiWindow (const std::string &consoleVariable, bool isVisible, const std::string &name) | |
| Minimal constructor using default size and flags. | |
| GuiWindow (const std::string &consoleVariable, const std::string &name, ImVec2 originalSize, uint32_t windowFlags) | |
| Constructor deriving initial visibility from the CVar value. | |
| GuiWindow (const std::string &consoleVariable, const std::string &name, ImVec2 originalSize) | |
| Constructor deriving visibility from CVar, with default flags. | |
| GuiWindow (const std::string &consoleVariable, const std::string &name) | |
| Minimal constructor deriving visibility from CVar. | |
| void | Draw () override |
| Calls ImGui::Begin(), invokes DrawElement(), and calls ImGui::End(). | |
Public Member Functions inherited from Ship::GuiElement | |
| GuiElement (const std::string &name, bool isVisible) | |
| Constructs a GuiElement with an explicit initial visibility. | |
| GuiElement (const std::string &name) | |
| Constructs a GuiElement that starts hidden. | |
| virtual | ~GuiElement () |
| void | Update () |
| Updates element state for the current frame (called before Draw). | |
| void | Show () |
| Makes the element visible (equivalent to SetVisibility(true)). | |
| void | Hide () |
| Hides the element (equivalent to SetVisibility(false)). | |
| void | ToggleVisibility () |
| Flips the visibility state between shown and hidden. | |
| bool | IsVisible () |
| Returns true if the element is currently visible. | |
Public Member Functions inherited from Ship::Component | |
| Component (const std::string &name, std::shared_ptr< Context > context=nullptr) | |
| Constructs a Component with the given name. | |
| virtual | ~Component () |
| void | Init (const nlohmann::json &initArgs=nlohmann::json::object()) |
| Performs one-time initialization of this component. | |
| bool | IsInitialized () const |
| Returns true once Init() (or MarkInitialized()) has completed successfully. | |
| const std::string & | GetName () const |
| Returns the name of this Component. | |
| std::string | ToString () const |
| Returns a human-readable string representation (e.g. "Name (id)"). | |
| std::string | ToTreeString (int depth=0) const |
| Returns a human-readable tree representation of this component and its children. | |
| operator std::string () const | |
| Conversion operator to std::string; equivalent to ToString(). | |
| ParentComponentList & | GetParents () |
| Returns a mutable reference to the parent list. | |
| const ParentComponentList & | GetParents () const |
| Returns a const reference to the parent list. | |
| ComponentList & | GetChildren () |
| Returns a mutable reference to the child list. | |
| const ComponentList & | GetChildren () const |
| Returns a const reference to the child list. | |
| virtual std::shared_ptr< Component > | TryGetSharedComponent () noexcept |
| Returns a shared_ptr to this Component when available, otherwise nullptr. | |
| virtual std::shared_ptr< Component > | GetSharedComponent () |
| Returns a shared_ptr to this Component via the correct enable_shared_from_this base. | |
| template<typename T > | |
| bool | HasInChildren () const |
| Checks whether any descendant Component matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< T > | GetFirstInChildren () const |
| Returns the first descendant that matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< std::vector< std::shared_ptr< T > > > | GetInChildren () const |
| Returns all descendants that match type T via BFS. | |
| template<typename T > | |
| bool | HasInParents () const |
| Checks whether any ancestor Component matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< T > | GetFirstInParents () const |
| Returns the first ancestor that matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< std::vector< std::shared_ptr< T > > > | GetInParents () const |
| Returns all ancestors that match type T via BFS. | |
Public Member Functions inherited from Ship::Part | |
| Part () | |
| Constructs a Part and assigns it a unique ID. | |
| Part (std::shared_ptr< Context > context) | |
| Constructs a Part with an explicit Context reference and unique ID. | |
| virtual | ~Part ()=default |
| uint64_t | GetId () const |
| Returns the unique identifier for this Part. | |
| bool | operator== (const Part &other) const |
| Compares two Parts for equality by their unique IDs. | |
| std::shared_ptr< Context > | GetContext () const |
| Returns the Context this Part belongs to, or nullptr if unset. | |
| void | SetContext (std::shared_ptr< Context > ctx) |
| Sets the Context this Part belongs to. | |
Protected Member Functions | |
| void | OnInit (const nlohmann::json &initArgs=nlohmann::json::object()) override |
| Registers button bitmasks and performs initial population of mapping tables. | |
| void | DrawElement () override |
| Renders the full port-tabbed input editor UI. | |
| void | UpdateElement () override |
| Refreshes cached mapping-ID tables and manages the rumble test timer. | |
Protected Member Functions inherited from Ship::GuiWindow | |
| void | SetVisibility (bool visible) override |
| Overrides SetVisibility to also write the new state to the backing CVar. | |
| void | BeginGroupPanel (const char *name, const ImVec2 &size) |
| Begins a visually grouped labelled panel. | |
| void | EndGroupPanel (float minHeight) |
| Ends the previously opened group panel, adding a bottom margin. | |
| void | SyncVisibilityConsoleVariable () |
| Reads the CVar and updates mIsVisible accordingly. | |
| std::shared_ptr< Window > | GetWindow () const |
| Returns the Window this GuiWindow belongs to. | |
Protected Member Functions inherited from Ship::Component | |
| void | MarkInitialized () |
| Marks this component as initialized without going through Init(). | |
| template<typename T > | |
| std::shared_ptr< T > | RequireDependency (const std::shared_ptr< T > &dependency, const std::string &dependencyName) const |
| Returns a cached dependency after validating it exists and is initialized. | |
Protected Member Functions inherited from Ship::Part | |
| virtual void | OnAdded (bool forced) |
| Called after this Part has been added to a PartList. | |
| virtual void | OnRemoved (bool forced) |
| Called after this Part has been removed from a PartList. | |
Additional Inherited Members | |
Protected Attributes inherited from Ship::GuiElement | |
| bool | mIsVisible |
| Current visibility state. Subclasses may read this directly. | |
An ImGui window for editing, binding, and testing controller mappings.
InputEditorWindow provides a tab-based UI that allows the user to:
The window is added to the GUI by Context::Init() and is accessible via Gui::GetGuiWindow("Input Editor").
| LUS::InputEditorWindow::InputEditorWindow | ( | const std::string & | consoleVariable, |
| const std::string & | name, | ||
| std::shared_ptr< Ship::ControlDeck > | controlDeck, | ||
| std::shared_ptr< Ship::Window > | window | ||
| ) |
Constructs an InputEditorWindow with constructor-injected dependencies.
| consoleVariable | CVar name controlling window visibility. |
| name | Window title. |
| controlDeck | ControlDeck for reading/writing controller mappings. |
| window | Window for GUI and mouse capture state. |
|
virtual |
Destroys the InputEditorWindow and releases any active rumble test state.
| void LUS::InputEditorWindow::DrawAnalogPreview | ( | const char * | label, |
| ImVec2 | stick, | ||
| float | deadzone = 0, |
||
| bool | gyro = false |
||
| ) |
Renders a circular analog-stick preview widget.
| label | Label displayed above the preview. |
| stick | Current stick position (X and Y in the range [-128, 127]). |
| deadzone | Deadzone radius drawn as an inner circle (0 = no deadzone ring). |
| gyro | If true, renders the preview in "gyro" style. |
|
overrideprotectedvirtual |
Renders the full port-tabbed input editor UI.
Implements Ship::GuiElement.
| void LUS::InputEditorWindow::DrawInputChip | ( | const char * | buttonName, |
| ImVec4 | color | ||
| ) |
Renders a small coloured chip labelled with buttonName.
Used to represent a single physical button within the editor layout.
| buttonName | Human-readable button label. |
| color | Background colour of the chip. |
|
overrideprotectedvirtual |
Registers button bitmasks and performs initial population of mapping tables.
Reimplemented from Ship::GuiWindow.
| bool LUS::InputEditorWindow::TestingRumble | ( | ) |
Returns true while the rumble test is actively playing.
|
overrideprotectedvirtual |
Refreshes cached mapping-ID tables and manages the rumble test timer.
Implements Ship::GuiElement.