GithubHelp home page GithubHelp logo

nkoturovic / cppurses Goto Github PK

View Code? Open in Web Editor NEW

This project forked from a-n-t-h-o-n-y/termox

0.0 2.0 0.0 6.84 MB

C++14 Terminal User Interface framework with NCurses.

License: MIT License

CMake 3.70% C++ 96.30%

cppurses's Introduction

Build Status Join the chat Read the Wiki Read the Reference

TUI Library

CPPurses is a Terminal User Interface(TUI) Library built on top of ncurses. It defines a framework of Widgets, Layouts, and Events that let you focus on user interface design, while boilerplate common to ncurses applications is handled behind the scenes.

CPPurses contains a collection of common Widgets that can be pieced together to create a composite application. It is also possible to expand and build on top of existing Widgets, or to create completely new Widget types, by overriding a few virtual functions.

This is a work in progress. The API is not stable.

Usage

See the wiki for examples.

Reference documentation can be found here.

Features

  • Simple event system interface for handling mouse, keyboard and animation events, among others.
  • Library of commonly used Widget types.
  • Widget reuse and expansion through inheritance.
  • Layout Widgets which automatically resize and move their children.
  • Signals and Slots for communication between Widgets.
  • Extensible color palettes.
  • Border drawing and customization.

Build Instructions

CPPurses depends on two header only libraries, this repo includes them as git submodules. You'll need NCurses installed on your system.

git clone https://github.com/a-n-t-h-o-n-y/CPPurses.git
mkdir CPPurses/build && cd CPPurses/build
git submodule update --init --recursive   # Pull in dependencies
cmake -DCMAKE_BUILD_TYPE=Release ..       # Generate Makefiles
make                                      # Build library
make demos                                # Build demos(optional)
sudo make install    # Install header and library archive to system defaults

Installing the library with CMake will place the headers and the library archive in the standard GNU install directories.

Using the Library

As a submodule:

# CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
add_executable(foo foo.cpp ...)

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

As an installed library:

# CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
add_executable(foo foo.cpp ...)

# CPPurses is installed on your system and linker can find cppurses:
target_compile_features(foo PRIVATE cxx_std_14)
target_link_libraries(foo cppurses ncurses pthread)

Without CMake, link with cppurses, ncurses and your system's thread library. If the library is installed your linker flags will be something like:

-lcppurses -lncurses -pthread

C++14 or above will need to be used.

License

This software is distributed under the MIT License.

Gallery

Game of Life

Chess

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.