-
Notifications
You must be signed in to change notification settings - Fork 0
NCurses
To allow plugins managing TUI completely, CROGUE opens some basic NCurses functions for plugins. Usage of them is not shown here. Look at NCurses documentation for them.
Warning
Do not destroy TUI Avoid using clear() to refresh game UI. You may remove a thing a plugin did.
Functions:
cr.curses.printwcr.curses.movecr.curses.mvprintwcr.curses.clearcr.curses.refreshcr.curses.getchcr.curses.attrsetcr.curses.attroncr.curses.attroffcr.curses.curs_setcr.curses.getmaxyx
Warning
cr.curses.getmaxyx function is not used as in normal NCurses.
It returns a table with x, y values.
Usage:
local cords = cr.curses.getmaxyx()
printw("X: " .. cords.x .. " Y: " .. cords.y)And you can use cr.curses.attr_t as NCurses attr_t.
If you hate ncurses attrs like me you can use cr.curses.ansi2attr function to get ncurses attrs:
local red = cr.curses.ansi2attr("38;5;1m")
cr.curses.attron(red)
cr.curses.printw("This is a red text!")
cr.curses.attroff(red)See [ANSI Support][./ansi.md] for the full list of supported ansi codes.
All of the NCurses KEY_ variables are accessable from cr.curses.
See NCurses documentation or ncurses.h header on your system for full list of KEY_ variables.
Example:
local c = cr.curses
c.printw("Press a key")
c.refresh()
local key = c.getch()
if (key == c.KEY_ENTER)
c.printw("You pressed enter!")
end-
Getting Started
-
Metadata
-
Variable Types and Variables
-
Game Status
-
TUI