Giter VIP home page Giter VIP logo

termox's Introduction

Build Status Read the Manual Read the Reference

TermOx ๐Ÿ‚

TermOx is a Terminal User Interface Framework for C++17. Built on top of nCurses, it defines a set of Widgets, Layouts, and Events that make it quick to craft unique user interfaces in the terminal.

The Widget Library contains many common Widget and Layout types that can be pieced together to create a composite interface. It's easy to expand on top of these types to create new Widgets and Layouts.

This project was previously named CPPurses.

Usage

#include <termox/termox.hpp>

int main()
{
    using namespace ox;
    auto app =
        layout::vertical(
            textbox("Hello, World!" | fg(Color::Red) | Trait::Bold) | pipe::name("tb"),
            layout::horizontal<Button>(
                button("Button 1") | bg(Color::Blue) | pipe::name("b1"),
                button("Button 2") | bg(Color::Violet) | pipe::name("b2")
            ) | pipe::fixed_height(1)
        );
    auto& tb = app->find_child_by_name("tb");
    app->find_child_by_name("b1") | pipe::on_press([&tb]{ tb.append("Button 1 Pressed"); });
    app->find_child_by_name("b2") | pipe::on_press([&tb]{ tb.append("Button 2 Pressed"); });
    return System{}.run(*app);
}

See the Manual for more in depth explanations and examples.

Reference documentation can be found here.

Features

  • Event System to handle Mouse, Keyboard and Animation events, among others

  • Signals and Slots to communicate between Widgets

  • Color Palettes and Dynamic Colors

  • Animation

  • Inherit from existing Widgets and Layouts to create new UI elements

  • Library of commonly used Widgets and Layouts

Build Instructions

TermOx depends on a Signals library and nCurses, these are both included as git submodules.

git clone https://github.com/a-n-t-h-o-n-y/TermOx.git
mkdir TermOx/build && cd TermOx/build
git submodule update --init --recursive   # Pull in dependencies
cmake .. -DCMAKE_BUILD_TYPE=Release       # Generate Makefiles
make                                      # Build library
make demos                                # Build demos(optional)

Using the Library

It is recommended to clone this library into your project and use it as a submodule rather than installing it to your system. This way you can lock your application to a specific version of TermOx.

CMake will add the library target TermOx if you add the TermOx directory with add_subdirectory(...).

# CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
add_executable(my_app
               my_app.main.cpp
               ...
)

# TermOx is cloned into a directory named external/
add_subdirectory(external/TermOx)
target_link_libraries(foo TermOx)

License

This software is distributed under the MIT License.

termox's People

Contributors

a-n-t-h-o-n-y avatar sheldonth avatar jktjkt avatar buzzert avatar hsnks100 avatar luluvia avatar nkoturovic avatar thknepper avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.