No description
Find a file
2018-10-14 08:19:03 -07:00
.vscode Hello world 2018-10-11 19:00:40 -07:00
binaries Temporarily include a REXPaint loader (almost done) 2018-10-13 21:15:16 -07:00
src Move the whole library into one file 2018-10-13 22:38:58 -07:00
tests Add missing files to git 2018-10-14 08:19:03 -07:00
.gitignore Temporarily include a REXPaint loader (almost done) 2018-10-13 21:15:16 -07:00
BearLibTerminal.h Add some helpful notes 2018-10-13 22:47:28 -07:00
bearlibterminal.nimble Add missing files to git 2018-10-14 08:19:03 -07:00
blt_nim.code-workspace Hello world 2018-10-11 19:00:40 -07:00
demo.nim Add some helpful notes 2018-10-13 22:47:28 -07:00
LICENSE Add missing files to git 2018-10-14 08:19:03 -07:00
Makefile Temporarily include a REXPaint loader (almost done) 2018-10-13 21:15:16 -07:00
Readme.md Installation instructions 2018-10-13 22:44:44 -07:00

BearLibTerminal-Nim

This is a port of BearLibTerminal to Nim.

Installation

  1. Download the shared library binary from the BearLibTerminal web site.
  2. nimble install bearlibterminal
  3. Make sure the shared library is somewhere it can be found. For development, this would typically be the working directory of your program when it runs.

Usage

All functions are identical to the C versions, except:

  • int is aliased to BLInt
  • uint32 is aliased to BLColor
  • x, y, w, h is passed as a single BLRect
  • x, y is passed as a single BLPoint
  • w, h is passed as a single BLSize
  • Return values of TK_ON/TK_OFF are converted to bool
  • Functions requiring mutable pointers for multiple return values are wrapped to return appropriate types (string, BLSize)

The library also includes some bonus functions to save you some unsafe bit casts:

proc terminalGetCurrentLayer*(): BLInt = terminalState(TK_LAYER)
proc terminalGetCurrentColor*(): BLColor = cast[BLColor](terminalState(TK_COLOR))
proc terminalGetCurrentBackgroundColor*(): BLColor = cast[BLColor](terminalState(TK_BKCOLOR))
proc terminalGetIsCompositionEnabled*(): bool = terminalCheck(TK_COMPOSITION)