BearLibTerminal

download | documentation | source code | forum

BearLibTerminal is a library that creates a terminal-like window facilitating flexible textual output and uncomplicated input processing.

A lot of roguelike games intentionally use asketic textual or pseudographic visual style. However, native output via the command line interface ususally have a few annoying shortcomings like low speed or palette and font restrictions. Using an extended character set (several languages at once or complicated pseudographics) may also be tricky. BearLibTerminal solves that by providing it's own window with a grid of character cells and simple yet powerful API for configuration and textual output.

Notable features of BearLibTerminal include:

  • Ease of Unicode usage.
  • Support for bitmap and vector (TrueType) fonts.
  • Extended output facilities: tile composition, alignment, offsets.
  • High performance (uses OpenGL).
  • Keyboard and mouse support.
  • Windows, Linux and OS X builds.
  • Bindings for several programming languages: С/С++, C#, Lua, Pascal, Python, Ruby.

There are similar tools, also primarily intended for roguelike development:

Unlike popular libtcod library, BearLibTerminal focuses on graphics output. It does not include random number generators or path finding algorithms. Instead BearLibTerminal provides a lot more options for font/tileset configuration and tile-based output.

Some screenshots

Simple example: C/C++

#include "BearLibTerminal.h"
 
int main()
{
    terminal_open();
 
    // Printing text
    terminal_print(1, 1, "Hello, world!");
    terminal_refresh();
 
    // Wait until user close the window
    while (terminal_read() != TK_CLOSE); 
 
    terminal_close();
}

Simple example: Python

from bearlibterminal import terminal

terminal.open()
terminal.printf(1, 1, 'Hello, world!')
terminal.refresh()

while terminal.read() != terminal.TK_CLOSE:
    pass

terminal.close()

Download

Current version is 0.15.4 (changelog).

Archives for Windows, Linux and OS X contain library binary (both 32 and 64 bit versions), a quick showcase of library capabilities and header files for several programming languages.

Python version (library binary + wrapper module) may be installed directly from pypi:
pip install bearlibterminal
(You may want to adjust the command a bit, e. g. use pip3 for Python3 or add --user to install locally.)

Documentation

License

The library is licensed mainly under the MIT license with a few parts under other permissive licenses: