libtui
Loading...
Searching...
No Matches
Draw

Files

file  libtui_draw.h
 The group of functions that provide a nice interface for the client to draw to screen.
 

Enumerations

enum  LIBTUI_DRAW_ERR { DRAW_ERROR_OK = 0 , DRAW_ERROR_NULL_RENDERER , DRAW_ERROR_INVALID_DIMENSIONS , DRAW_ERROR_COUNT }
 Error Codes For Draw Module. More...
 

Functions

const char * libtui_draw_err_str (enum LIBTUI_DRAW_ERR err)
 This function returns the string that corresponds to the given LIBTUI_DRAW_ERR.
 
enum LIBTUI_DRAW_ERR libtui_draw_clear_with_char (struct libtui_renderer *const renderer, const char c)
 Clears the screen with the specified char.
 
enum LIBTUI_DRAW_ERR libtui_draw_clear (struct libtui_renderer *const renderer)
 Clears the screen.
 
enum LIBTUI_DRAW_ERR libtui_draw_single_char (struct libtui_renderer *const renderer, const char c, size_t x, size_t y)
 Draws a single char at the specified (x, y).
 

Detailed Description

All the things about the draw module

Enumeration Type Documentation

◆ LIBTUI_DRAW_ERR

Error Codes For Draw Module.

Enumerator
DRAW_ERROR_OK 

No Error.

DRAW_ERROR_NULL_RENDERER 

The libtui_renderer* passed in as an argument is NULL.

DRAW_ERROR_INVALID_DIMENSIONS 

The dimensions that were passed to the function were invalid.

DRAW_ERROR_COUNT 

Count of errors.

Function Documentation

◆ libtui_draw_clear()

enum LIBTUI_DRAW_ERR libtui_draw_clear ( struct libtui_renderer *const renderer)

Clears the screen.

Clears the screen with ' '.

Parameters
rendererThe renderer to clear
Returns
Returns an enum LIBTUI_DRAW_ERR as the function result;

◆ libtui_draw_clear_with_char()

enum LIBTUI_DRAW_ERR libtui_draw_clear_with_char ( struct libtui_renderer *const renderer,
const char c )

Clears the screen with the specified char.

example: if c == 'X': whole screen will be made up of 'X' chars.

Parameters
rendererThe renderer to clear.
cThe char to clear with.
Returns
Return an enum LIBTUI_DRAW_ERR as the function result;

◆ libtui_draw_err_str()

const char * libtui_draw_err_str ( enum LIBTUI_DRAW_ERR err)

This function returns the string that corresponds to the given LIBTUI_DRAW_ERR.

Parameters
errThe error code to get the correspinding string.

◆ libtui_draw_single_char()

enum LIBTUI_DRAW_ERR libtui_draw_single_char ( struct libtui_renderer *const renderer,
const char c,
size_t x,
size_t y )

Draws a single char at the specified (x, y).

The origin of the screen is top-left.

Parameters
rendererThe renderer to draw to.
cThe char to draw.
xThe x position of the draw position.
yThe y position of the draw position.
Returns
Returns an enum LIBTUI_DRAW_ERR as the function result;