libtui
Loading...
Searching...
No Matches
Renderer

Files

file  libtui_renderer.h
 The magical part that handles the libtui_buffer and screen.
 

Data Structures

struct  libtui_renderer
 Struct that holds data used by therendering module. More...
 

Enumerations

enum  LIBTUI_RENDERER_ERR { RENDERER_ERROR_OK = 0 , RENDERER_ERROR_MALLOC_FAILED , RENDERER_ERROR_NULL_RENDERER , RENDERER_ERROR_COUNT }
 

Functions

const char * libtui_renderer_err_str (enum LIBTUI_RENDERER_ERR err)
 This function returns the string that corresponds to the given LIBTUI_RENDERER_ERR.
 
enum LIBTUI_RENDERER_ERR libtui_renderer_create (size_t width, size_t height, struct libtui_renderer **const renderer_out)
 Creates a new libtui_renderer.
 
enum LIBTUI_RENDERER_ERR libtui_renderer_render (struct libtui_renderer *const renderer)
 Renders the final buffer to the screen.
 
enum LIBTUI_RENDERER_ERR libtui_renderer_free (struct libtui_renderer *renderer)
 Frees the renderer completely.
 

Detailed Description

All the things about the libtui_renderer and the renderer module

Enumeration Type Documentation

◆ LIBTUI_RENDERER_ERR

Error Codes For Renderer Module

Enumerator
RENDERER_ERROR_OK 

No Error.

RENDERER_ERROR_MALLOC_FAILED 

Tried to use malloc but failed.

RENDERER_ERROR_NULL_RENDERER 

The libtui_renderer* passed in as an argument is NULL.

RENDERER_ERROR_COUNT 

Total number of errors.

Function Documentation

◆ libtui_renderer_create()

enum LIBTUI_RENDERER_ERR libtui_renderer_create ( size_t width,
size_t height,
struct libtui_renderer **const renderer_out )

Creates a new libtui_renderer.

Client must free the struct libtui_renderer with libtui_renderer_free.

Parameters
widthThe width of the screen that the renderer will work on
heightThe height of the screen that the renderer will work on
Returns
Returns the created renderer in struct libtui_renderer **const renderer_out parameter.
Returns an enum LIBTUI_RENDERER_ERR as the function result.

◆ libtui_renderer_err_str()

const char * libtui_renderer_err_str ( enum LIBTUI_RENDERER_ERR err)

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

Parameters
errThe error code to get the correspinding string.

◆ libtui_renderer_free()

enum LIBTUI_RENDERER_ERR libtui_renderer_free ( struct libtui_renderer * renderer)

Frees the renderer completely.

After calling this, don't use any pointer to the struct libtui_buffer or the char* inside because they will be freed.

Parameters
rendererThe strcut libtui_renderer to free
Returns
Returns an enum LIBTUI_RENDERER_ERR as the function result.

◆ libtui_renderer_render()

enum LIBTUI_RENDERER_ERR libtui_renderer_render ( struct libtui_renderer *const renderer)

Renders the final buffer to the screen.

Parameters
rendererThe struct libtui_renderer to render to screen.
Returns
Returns an enum LIBTUI_RENDERER_ERR as the function result.