← Back

ofxGuiJson

github.com/moreno-moises/ofxGuiJson · @moreno-moises
OF 0.11 GUI

An openFrameworks addon that builds GUIs from a JSON config file, dynamically mapping controls and user interactions to application functions.

0 1 Last commit 2y ago Created 2y ago

README

README for ofxGUIJson Project



The ofxGUIJson project leverages OpenFrameworks to create a dynamic and scalable GUI system. It uses a JSON configuration file to define GUI elements and map user interactions dynamically to various functions within an application. This README provides essential guidance on setup, configuration, and a detailed overview of the project's structure.

System Requirements

Installation

To set up the ofxGUIJson project in your environment, follow these steps:

1. Clone the Repository:
   git clone https://github.com/moreno-moises/ofxGuiJson.git
   
2. Add to OpenFrameworks:
  • Copy the downloaded ofxGUIJson folder into the addons directory of your OpenFrameworks installation.
3. Create a Project:
  • Use the OpenFrameworks project generator to create a new project.
  • Include ofxGuiJson and ofxGui as addons in your project setup.
4. Build and Run:
  • Open your project in the respective IDE configured with OpenFrameworks.
  • Build and run the application to verify the setup.

Usage

Configuration

The GUI configuration is driven by a JSON file which specifies the structure, properties, and initial settings of the GUI elements:
json { "panels": [ { "gui": { "title": "Dynamic Audio Control", "width": 500, "height": 700, "position": {"x": 0, "y": 0} }, "elements": [ { "type": "toggle", "label": "Mute Sound", "id": "muteToggle", "default": false, "action": "toggleMute" } ] } ] }
This JSON structure allows you to define multiple panels and elements, including labels, toggles, and other controls, with specific actions tied to user interactions.

Function Mapping

Functions are mapped to GUI elements through the JSON configuration. This mapping connects user interactions with specific callbacks defined in your OpenFrameworks application:
cpp void ofApp::setup() { guiManager.setup("config.json"); // Load GUI configuration actionMap["toggleMute"] = &ofApp::onToggleChanged; // Map "toggleMute" action to a function } `` Each action in the JSON file corresponds to a member function in the application, allowing dynamic interaction management.

Project Structure



image

Lower Level Project Structure Diagram



image (3)

This diagram illustrates the modular and event-driven architecture of ofxGuiJson, where GUI actions are tightly integrated with event handling and callback mechanisms, facilitating a responsive and dynamic user interface

Known Issues

For a list of known issues and feature requests, check the issues section on GitHub. Please report any new issues or bugs you encounter.

Future Work

As ofxGuiJson continues to evolve, the following are key enhancements planned for future versions, aimed at making the GUI more flexible and user-friendly: 1. Implement note adding (log note) with ofxTextField - Allow users to add notes directly within the GUI. 2. Font Customization Features: 3. GUI Groups: Organize elements into logical groups for better management. 4. Multi-Select and Single-Select Lists: Implement systems for selecting multiple options from lists, enhancing JSON compatibility. 5. Device Connection Conditionals: Add GUI elements that react based on device connectivity. 6. Toggle Enabling/Disabling: Provide options to disable or enable toggles dynamically. 7. Responsive Design: Adapt GUI widths as percentages to maintain layout integrity when resizing windows. 8. Propagation of Positions and Dimensions in Multiple Panels: Ensure consistent layout across multiple panels. 9. Enhanced File Loading: Allow loading multiple JSON files, facilitating easier customization and scalability.

Get this addon

HTTPS
SSH