Search

Create TUI apps with C++ and TermOx

To create graphical programs in Terminal more easily.


Create TUI apps with C++ and TermOx


This project was formerly called CPPurses, but the name has been changed to TermOx.

It is a framework based on NCURSES to create applications that run on terminal .


Installation

Make sure you have the following software and libraries installed on your system:

Then clone the project and build:

git clone --recurse-submodules https://github.com/a-n-t-h-o-n-y/TermOx
cd TermOx
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make


Before installing also build the demos.

If your system is in a language other than US English, run this command first:

sed -i "s/en_US\.UTF-8/$LANG/g" ../external/Escape/src/terminal.cpp

Now build the demos:

make demos

Try the demos

./demos/demos

A menu with the examples will open, navigate using the up and down arrow keys and select by pressing Enter. To return to the menu press ESC and to close the demos press Ctrl + c .

And finally install on your system:

cd ../..
sudo mv TermOx /opt/


Creating a Hello, World

Create a project directory in it, example: mkdir myapp && cd myapp.

Now also create an example file main.cpp and insert the content below:

#include <termox/termox.hpp>

int main(){
    return ox::System{}.run<ox::Textbox>("Hello, World!");
}

And to build use CMake and create a nvim CMakeLists.txt and insert the content below:

cmake_minimum_required(VERSION 3.9)
project(MyApp)
add_subdirectory(TermOx)
add_executable(hello-world main.cpp)
target_link_libraries(hello-world PRIVATE TermOx)

Now copy TermOx to your project:

cp -r /opt/TermOx .

Create a build directory and build:

mkdir build && cd build
cmake..
make

And test your Hello, World:

It’s like a mini text editor, feel free to use it:

./hello-world

Press Ctrl +c to exit.


For more documentation visit the repository .


cpp ncurses terminal


Share



Comments