This is a simple GUI library for C++ designed for console applications on Windows OS. It provides basic functionalities to create menus, handle user input, and display text with colors in the console.
- Clear the console screen
- Wait for user input
- Change the state of the GUI
- Display menus and settings
- Handle user input for menu navigation
- Display text with colors
- Full-screen mode support
- Clone the repository:
git clone https://github.com/antialberteinstein/gui-library.git
- Include the
gui.h
andgui.cpp
files in your project, make sure thatgui.cpp
is compiled with code source. - NOTE: You may be able to change
gui.cpp
andgui.h
for your purpose, we are welcome about those.
Before using the GUI library, initialize it by calling:
init_gui();
-
Define the actions for your menu items:
void action1() { cout << "Action 1 selected" << endl; } void action2() { cout << "Action 2 selected" << endl; }
-
Create a
Settings
object and aMenu
object:Settings settings; Menu menu(settings);
-
Add items to the menu:
menu.add_item("Option 1", action1); menu.add_item("Option 2", action2);
-
Show the menu and handle user input:
bool running = true; while (running) { menu.show(); menu.update(); attach_running(running); }
Use the set_color
and reset_color
functions to display text with colors:
set_color(RED);
cout << "This is red text" << endl;
reset_color();
Enter full-screen mode by calling:
enter_full_screen();
Here is a complete example of a simple program using the GUI library:
#include "gui.h"
void action1() {
cout << "Action 1 selected" << endl;
}
void action2() {
cout << "Action 2 selected" << endl;
}
int main() {
init_gui();
Settings settings;
Menu menu(settings);
menu.add_item("Option 1", action1);
menu.add_item("Option 2", action2);
bool running = true;
while (running) {
menu.show();
menu.update();
attach_running(running);
}
return 0;
}
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by antialberteinstein Thank you <3.