termbox 0.0.1

A port of the TUI library TermBox


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Termbox

This is a wrapper of the TUI library Termbox.

From the termbox Readme:

Termbox is a library that provides minimalistic API which allows the programmer to write text-based user interfaces.

It is based on a very simple abstraction. The main idea is viewing terminals as a table of fixed-size cells and input being a stream of structured messages. Would be fair to say that the model is inspired by windows console API. The abstraction itself is not perfect and it may create problems in certain areas. The most sensitive ones are copy & pasting and wide characters (mostly Chinese, Japanese, Korean (CJK) characters). When it comes to copy & pasting, the notion of cells is not really compatible with the idea of text. And CJK runes often require more than one cell to display them nicely. Despite the mentioned flaws, using such a simple model brings benefits in a form of simplicity. And KISS principle is important.

At this point one should realize, that CLI (command-line interfaces) aren't really a thing termbox is aimed at. But rather pseudo-graphical user interfaces.

Installation

Termbox-d is meant to be used as a dub package. Just install it by putting it in your dub.sdl or dub.json file.

dependency "termbox" version="*"

or

"dependencies": {
    "termbox": { "version": "*" }
}

Getting Started

See the examples/ directory for some examples of how to use Termbox.

The library consists of 12 functions:

init() // Initialization
shutdown() // Shutdown

width() // Width of the terminal screen
height() // Height of the terminal screen

clear() // Clear buffer
present() // Sync internal buffer with terminal

// Drawing functions
putCell()
changeCell()
blit()

selectInputMode() // Change input mode
peekEvent() // Peek a keyboard event
pollEvent() // Wait for a keyboard event

For full detail, source/termbox/package.d.

  • https://github.com/nsf/termbox - Termbox library
  • http://pecl.php.net/package/termbox - PHP Termbox wrapper
  • https://github.com/nsf/termbox-go - Go pure Termbox implementation
  • https://github.com/gchp/rustbox - Rust Termbox wrapper
  • https://github.com/fouric/cl-termbox - Common Lisp Termbox wrapper

License

Termbox-d is (like termbox) provided under the MIT license.

Authors:
  • Zachary Yedidia
Dependencies:
none
Versions:
0.0.5 2016-Mar-13
0.0.4 2016-Mar-12
0.0.3 2016-Mar-06
0.0.2 2016-Mar-05
0.0.1 2016-Mar-05
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 2 downloads this month

  • 478 downloads total

Score:
1.8
Short URL:
termbox.dub.pm