termbox-d

所属分类:collect
开发工具:D
文件大小:0KB
下载次数:0
上传日期:2019-08-20 01:59:57
上 传 者sh-1993
说明:  TUI库Termbox的D包装器,
(A D wrapper of the TUI library Termbox,)

文件列表:
build-termbox.sh (486, 2019-08-19)
dub.sdl (272, 2019-08-19)
examples/ (0, 2019-08-19)
examples/helloWorld/ (0, 2019-08-19)
examples/helloWorld/dub.sdl (204, 2019-08-19)
examples/helloWorld/helloWorld.d (1033, 2019-08-19)
examples/mouseInput/ (0, 2019-08-19)
examples/mouseInput/dub.sdl (204, 2019-08-19)
examples/mouseInput/mouseInput.d (821, 2019-08-19)
source/ (0, 2019-08-19)
source/termbox/ (0, 2019-08-19)
source/termbox/color.d (618, 2019-08-19)
source/termbox/keyboard.d (2848, 2019-08-19)
source/termbox/package.d (7802, 2019-08-19)

# Termbox This is a wrapper of the TUI library [Termbox](https://github.com/nsf/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. ```sdl dependency "termbox" version="~master" ``` or ```json "dependencies": { "termbox": { "version": "~master" } } ``` # Getting Started See the `examples/` directory for some examples of how to use Termbox. The library consists of the following functions: ```d init() // Start termbox shutdown() // Shutdown width() // Width of the terminal screen height() // Height of the terminal screen clear() // Clear the screen setClearAttributes(ushort fg, ushort bg) // Attributes for clearing the screen flush() // Sync internal buffer with terminal putCell(int x, int y, Cell* cell) // Draw cell at position x y setCell(int x, int y, uint ch, ushort fg, ushort bg) // Put the character ch at position x y with color fg and bg setInputMode(InputMode mode) // Change the input mode setOutputMode(OutputMode mode) // Change the output mode peekEvent(Event* e) // Peek an event pollEvent(Event* e) // Wait for an event setCursor(int x, int y) // Put the cursor at x, y hideCursor() // Hide the cursor ``` For full detail, `source/termbox/package.d`. # Links - 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.

近期下载者

相关文件


收藏者