Skip to content

BerniSc/ConsoleGUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConsoleGUI

Project to write a simple, universal console GUI for providing Sliders, Buttons etc. to change Parameters for any C++ Program in realtime.

image

The selected Row can be changed by pressing 'w' for up or 's' for down. The value can be changed (single) by 'a' or 'd' or bulk-wise by 'A' or 'D' and toggled by Space. The GUI Application is closed by pressing 'q'.
In the specific case of the Button-Group the values can be changed by 'a', 'd' or Space and the selected Button is switched by 'A' and 'D'.

The width of the GUI and other paramters can be changed before the build using the GUI/gui_config.hpp file.

The Idea is that for example the GUI is put before the acutal programm or in specified parts of the actual programm that allow for the changing of Parameters.

To add Values that can be changed the Folder GUI has to be in the same directory and then the header GUI/gui.hpp has to be included.
After that values can be added to the GUI by calling GUI::addElements(). This Function always takes as many elements as the User wants to add, as long as they come in pairs. These pairs always consist of a String that describes what the Element looks like and how it behaves in the GUI and then the Variable that is to be changed.

The Syntax for the Description-Strings is hereby (in this example it is assumed that the default value for the seperation charactes has not been changed. This could be done via the gui_config header). The Values with the Questionmarks do not apply for every element and are therefore not always expected:

 <IDENTIFIER>#<?POSITION?>#<TEXT>#<?SIZE?>#<?STARTVALUE?>

Examples:

  • Slider: "s#<Text>#<Size>#<Startvalue>"   -> Identifier "s"

  • Button: "b#<Text>"                      -> Identifier "b"

  • Button-Group: "bg#<Position>#<Text>"    -> Identifier "bg"

    For the Button Group the "Position" of the Button-group is passed and after that just the parameters for a regular Button. The GUI adds this button automaticly to the respective Group.

CGUI_Config_Demo


This is an exemplary configuration/use of the C-GUI. This example here is for configuring the image displayed on Top.

Calling the GUI::startGUI() function blocks the calling thread, until the GUI is ended. Then the calling thread can run until the GUI::startGUI() function is called again.

An Example for the Implementation of the GUI can be seen in the "main.cpp" Function.


TODO-List for now:

  • learn how to write GitHub Readme's
  • Actually implement Text-Elements (like Output and Input Fields)
  • Add Features like editing GUI-List and Removing Elements
  • Ensure minimum Length for Button-Group Elements and Element-sizes in general
  • Hunt down Bug with selecting Element

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published