|
| | VexUI (VulkanContext &ctx, VirtualFileSystem *vfs, VulkanResources *res, ResolutionManager *resMgr) |
| | Constructor for VexUI.
|
| bool | init () |
| | Initialize the UI system, components needed later on.
|
| void | load (const std::string &path) |
| | Load UI data from a JSON file.
|
| void | render (VkCommandBuffer cmd, VkPipeline pipeline, VkPipelineLayout pipelineLayout, int currentFrame) |
| | Render the UI. It is called by main rendering function.
|
| void | processEvent (const SDL_Event &ev) |
| | Process mouse and keyboard events.
|
| Widget * | getFocusedWidget () const |
| | Get the currently focused widget.
|
| void | setText (const std::string &id, const std::string &txt) |
| | Set text of a UI element.
|
| void | setOnClick (const std::string &id, std::function< void()> cb) |
| | Set on-click callback of a UI element.
|
| Widget * | getWidget (const std::string &id) |
| | Get a UI element.
|
| UIStyle * | getStyle (const std::string &id) |
| | Get a UI element's style.
|
| void | setStyle (const std::string &id, const UIStyle &style) |
| | Set a UI element's style.
|
| void | setRotation (const std::string &id, float degrees) |
| | Set rotation of a widget in degrees.
|
| void | setPosition (const std::string &id, UIUnitValue x, UIUnitValue y) |
| | Move a widget (sets Left/Top yoga properties). Works best with position: absolute, or relative offsets.
|
| void | setSize (const std::string &id, UIUnitValue w, UIUnitValue h) |
| | Resize a widget.
|
| void | setImage (const std::string &id, const std::string &path) |
| | Change the image of an image widget.
|
| void | setFont (const std::string &id, const std::string &fontPath, UIUnitValue fontSize) |
| | Change font properties.
|
| void | setColor (const std::string &id, glm::vec4 color) |
| | Set text/tint color.
|
| void | setBackgroundColor (const std::string &id, glm::vec4 color) |
| | Set background color.
|
| void | setBorder (const std::string &id, UIUnitValue width, glm::vec4 color) |
| | Set border properties.
|
| bool | isInitialized () |
| | Check if the UI system is initialized.
|
| int | getZIndex () |
| | Get the current z-index of the UI system.
|
| void | setZIndex (int zIndex) |
| | Set the z-index of the UI system.
|
| void | update (float deltaTime=0.016f) |
| | Update the UI system.
|
| float | getPspMultiplier () const |
| glm::uvec2 | getRenderResolution () const |
|
| void | loadFonts (Widget *w) |
| | Loads fonts for the UI.
|
| void | loadImages (Widget *w) |
| | Loads images for the UI.
|
| void | layout (glm::uvec2 res) |
| | Layouts the UI using yoga.
|
| void | batch (Widget *w, std::vector< float > &verts, glm::vec2 parentOffset={0.f, 0.f}) |
| | Batches the UI for rendering.
|
| void | uploadVerts (const std::vector< float > &verts) |
| | Uploads the vertex buffer to the GPU.
|
| Widget * | parseNode (const nlohmann::json &j) |
| | Parses a node from json to widgets.
|
| void | freeTree (Widget *w) |
| | Frees the widget tree.
|
| Widget * | findWidgetAt (Widget *w, glm::vec2 pos, glm::vec2 parentOffset={0.f, 0.f}) |
| | Finds a widget at a position.
|
| Widget * | findById (Widget *w, const std::string &id) |
| | Finds a widget by its id.
|
| std::vector< std::string > | wrapText (const std::string &text, const FontAtlas &a, float maxWidth) |
| | Wraps text to fit within a given width.
|
| glm::vec2 | calculateTextSize (Widget *w, float maxWidth=FLT_MAX) |
| | Calculates the size of the text.
|
| void | safeUpdate (const std::string &id, std::function< void(Widget *)> action) |
| | Updates a widget safely.
|
| void | navigateToWidget (float dirX, float dirY) |
| | Navigate to widget in a given direction.
|
| void | getNavigableWidgets (std::vector< Widget * > &out) |
| | Get all navigable widgets (buttons).
|
| void | collectNavigableWidgets (Widget *w, std::vector< Widget * > &out) |
| | Recursively collect navigable widgets.
|
| bool | isWidgetNavigable (Widget *w) const |
| | Check if widget is navigable (button type).
|
| glm::vec2 | getWidgetCenter (Widget *w) |
| | Get widget center position in screen space.
|
| Widget * | findClosestNavigableWidget (const glm::vec2 &fromPos, const glm::vec2 &direction, const std::vector< Widget * > &candidates) |
| | Find closest navigable widget in a direction.
|
| void | setFocusedWidget (Widget *w) |
| | Set focus to a widget and trigger focus callbacks.
|
Class defining VexUI, it initializes the UI system, loads, renders, converts ui data, essentially managing ui from file to reneering.
Definition at line 139 of file VexUI.hpp.