Terminal GUI library for better handling of interface on terminals
Stands for ANSII TUI
Are you sick of having to handle your terminal all the time?
Have you thought about using any sample media library but you are stuck on TTY's?
Are you done handling yourself all the graphical user interfaces that has none to do with the agility of your terminal?
Then ANSUI is the best library available for you!
Zero-dependency terminal user interface header for uses with any application that's mainly focused windows.
Huge inspiration on SDL's media workaround, planning to add more support for CLI applications, like ratatui or ncurses, but keeping a it not heavy.
You can find a lot of examples on demos/, just run ./build.sh { example.c } and you'll run the example code you selected
Note
When the shell script is done, it also removes the compiled version of the code. For saving it - if you ever want to gdb it - run with -s or --saved parameter.
--- WINDOW CREATION Anyway, the most basic script for window creation is:
#include "ansui.h"
int main() {
// Initializing it envolves setting your backend: currently only TERMINAL | TODO: add support for SDL and/or GLFW
ansuiInit(ANSUI_INIT_TERMINAL_BACKEND);
// After initialization, you can set some flags to be used
// Input and Debug to be used: input allows for keys to be fetch, and debug will print FPS and Pixels printed
ansuiInitFlags(ANSUI_INIT_FLAG_TERMINAL_INPUT | ANSUI_INIT_FLAG_TERMINAL_DEBUG);
}In this case: ansuiInit() and ansuiQuit() are important => will be explained soon.
For windows, each has:
typedef struct ANSUI_WIN {
ANSUI_WIN_CONFIG* cfg; // Their configs = width, height, x, y
struct ANSUI_PIXEL* pxa; // Pixel Array = used on ansuiRender()
} ANSUI_WIN;Where:
- cfg is the brain of the window: stores the width, height, x, y, char, char color and background color;
- pxa is the pixel array => important mainly on
ansuiRender()
I'm planning on moving my projects to Codeberg ( since I don't want any AI judging my code haha )
So, on GitHub, It'll be just a showcase. The main repo ( with Issues, PR's ) is on Codeberg