Repository

Vcurses

What is Vcurses

vcurses is a TUI library for the pragramming language by the name of V

Installing Vcurses

to install vcurses on your machine... run the following command in your terminal

 v install Freeboardtortoise.vcurses

usage

import the module

import freeboardtortoise.vcurses

creating and initialising the terminal for vcurses

mut screen := vcurses.initialise() nb: when adding vcurses.initialise... before the program ends you must uninit the module

Clearing the screen

screen.clear()

addstr

addstr is the function to add text to the screen or a buffer screen.addstr("text to add", vcurses.Pos{x:0 , y:0 }) // insert whatever x and y positions that are needed.

write

write is the function used to add text to a screen or a buffer. screen.write("what to write")

move_cursor

move_cursor is the function to move the cursor to a position on the screen or in the buffer screen.move_cursor

rect

rect is the function to draw rectangles onto the screen in a curtain position screen.rect(vcurses.Pos{x:0,y:0}, vcurses.Pos{x:0,y:0}) // change pos1 and pos2 to fit your needs

Input

getch

getch is the function to get one charactor of input from a user. nb: this doesnt extend to the arrow keys or function keys, soon will be added data := screen.getch()

Buffers

creating a buffer

buffer := Buffer.new("name of the buffer")

writing to a buffer

buffer.write("string to write to the buffer")

clearing a buffer

buffer.clear()

move the buffer cursor

buffer.move_cursor(vcurses.Pos{0,0}) // adjust to your liking

adding a string to a specific place in the buffer

buffer.addstr("string to add", vcurses.Pos{0,0}) // adjust to your need

Add a rect to a buffer

buffer.rect(vcurses.Pos{0,0}, vcurses.Pos{0,0}) // adjust values to your liking

About

A fully native TUI package for the V programming language

0
2
4 days ago

Author

Freeboardtortoise