https://github.com/maipa01/mcui
mcui (MAIPA's Console User Interface) is a C++ library designed to simplify the creation of console-based menus and input fields. It provides a structured way to build interactive terminal interfaces with minimal effort.
https://github.com/maipa01/mcui
bsd-3-clause console cpp cpp-library cpp20 header-only open-source ui user-interface
Last synced: 2 months ago
JSON representation
mcui (MAIPA's Console User Interface) is a C++ library designed to simplify the creation of console-based menus and input fields. It provides a structured way to build interactive terminal interfaces with minimal effort.
- Host: GitHub
- URL: https://github.com/maipa01/mcui
- Owner: MAIPA01
- License: other
- Created: 2025-03-13T11:29:19.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-15T22:43:34.000Z (2 months ago)
- Last Synced: 2025-03-15T23:25:14.017Z (2 months ago)
- Topics: bsd-3-clause, console, cpp, cpp-library, cpp20, header-only, open-source, ui, user-interface
- Language: C++
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mcui - MAIPA's Console User Interface
## About
**mcui** (MAIPA's Console User Interface) is a C++ library designed to simplify the creation of console-based menus and input fields. It provides a structured way to build interactive terminal interfaces with minimal effort.
## Features
- **Menu System**: Easily create hierarchical console menus with selectable options.
- **User Input Handling**: Prompt users for input with a message.
- **Custom Views**: Define your own menu display style.
- **Header-Only**: Simple integration without the need for compilation.
- **Cross-Platform**: Works on **Windows, macOS, and Linux**.
- **C++20 Compatible**: Utilizes modern C++ features.## Requirements
- **C++ Standard**: Requires **C++20** or later.
- **Dependencies**: Uses [**mstd**](https://github.com/MAIPA01/mstd) (Maipa’s Standard Library).## Installation
No additional setup is required apart from including **mcui** headers and ensuring [**mstd**](https://github.com/MAIPA01/mstd) is available.
## Usage Examples
### Creating a Simple Menu
```cpp
#include
#includeusing namespace std;
using namespace mcui;void menu2OptionFunc() {
cout << "Menu 2 Option" << endl;
}MenuExitState menuOptionFunc() {
return MenuExitState::Exit;
}int main() {
MenuBuilder::makeStandardMenu("Menu", true, false, true,
MenuBuilder::makeStandardMenu("Menu2", true, true, false,
MenuBuilder::makeOption("Menu2 Option 1", &menu2OptionFunc)
),
MenuBuilder::makeOption("Exit", &menuOptionFunc)
)->run();
}
```### Creating a Simple Input Field
```cpp
#include
#includeusing namespace std;
using namespace mcui;int main() {
std::string name = InputBuilder::makeInput("Name: "s)->run();
cout << "Hello " << name << endl;
}
```### Customizing Menu Appearance
You can define your own menu rendering style by implementing a custom **View** structure:
```cpp
struct ViewSample {
static void printView(const std::string& menu_name,
const mstd::ordered_map& elements);
};
```## License
This project is licensed under the **BSD 3-Clause License with Attribution Requirement**. See the [`LICENSE`](./LICENSE) file for more details.