|
file | libtui_buffer.h |
| A readadble and writable 2D mapped buffer in the heap. WARNING: Internal, end user shouldn't use this.
|
|
|
struct | libtui_buffer |
| A struct that represents a 2D buffer. WARNING: Internal struct, end user shouldn't use this. More...
|
|
|
struct libtui_buffer * | libtui_buffer_create (size_t column, size_t row) |
| Allocates and returns owned pointer to the struct libtui_buffer struct. WARNING: Internal function, end user shouldn't use this.
|
|
size_t | libtui_buffer_get_index (const struct libtui_buffer *const buf, size_t x, size_t y) |
| Gets x, y positions and maps them according to the buf which is 1-Dimensional. WARNING: Internal Funcion, end user shouldn't use this.
|
|
void | libtui_buffer_set (struct libtui_buffer *const buf, const char c, size_t x, size_t y) |
| Sets the char at a specific position. WARNING: Internal Funcion, end user shouldn't use this.
|
|
char | libtui_buffer_get (const struct libtui_buffer *const buf, size_t x, size_t y) |
| Gets the char at a specific location. WARNING: Internal Funcion, end user shouldn't use this.
|
|
void | libtui_buffer_free (struct libtui_buffer *buf) |
| Frees the struct libtui_buffer and the buffer inside it. WARNING: Internal Funcion, end user shouldn't use this.
|
|
All the things aobut the libtui_buffer and the buffer module
◆ libtui_buffer_create()
struct libtui_buffer * libtui_buffer_create |
( |
size_t | column, |
|
|
size_t | row ) |
Allocates and returns owned pointer to the struct libtui_buffer struct. WARNING: Internal function, end user shouldn't use this.
- Returns
- Returns an strcut libtui_buffer which the caller is responsible to free using void void libtui_buffer_free(struct libtui_buffer *buf). Will return NULL if malloc fails.
- Parameters
-
column | The amount of chars it stores in the X axis. Must be bigger than 0 |
row | The amount of chars it stores in the Y axis. Must be bigger than 0 |
◆ libtui_buffer_free()
Frees the struct libtui_buffer and the buffer inside it. WARNING: Internal Funcion, end user shouldn't use this.
Must be called by the caller. Dont't use any pointers to the struct libtui_buffer neither the char* buf inside it.
- Parameters
-
buf | The pointer to the struct libtui_buffer that was created with struct libtui_buffer *libtui_buffer_create(size_t column, size_t row). This function will neither modify the pointer or the struct. |
◆ libtui_buffer_get()
char libtui_buffer_get |
( |
const struct libtui_buffer *const | buf, |
|
|
size_t | x, |
|
|
size_t | y ) |
Gets the char at a specific location. WARNING: Internal Funcion, end user shouldn't use this.
The origin is top-left.
- Returns
- Returns the char at given position. Will return '\0' in case of an error.
- Parameters
-
buf | The pointer to the struct libtui_buffer that was created with struct libtui_buffer *libtui_buffer_create(size_t column, size_t row). This function will neither modify the pointer or the struct. |
x | The x position of the wanted char. |
y | The y position of the wanted char. |
◆ libtui_buffer_get_index()
size_t libtui_buffer_get_index |
( |
const struct libtui_buffer *const | buf, |
|
|
size_t | x, |
|
|
size_t | y ) |
Gets x, y positions and maps them according to the buf which is 1-Dimensional. WARNING: Internal Funcion, end user shouldn't use this.
- Returns
- Returns the corresponding index in 1-Dimensional buffer. Returns 0 (origin) when something goes bad.
- Parameters
-
buf | The pointer to the struct libtui_buffer that was created with struct libtui_buffer *libtui_buffer_create(size_t column, size_t row). This function will neither modify the pointer or the struct. |
x | The x position of the wanted char. |
y | The y position of the wanted char. |
◆ libtui_buffer_set()
void libtui_buffer_set |
( |
struct libtui_buffer *const | buf, |
|
|
const char | c, |
|
|
size_t | x, |
|
|
size_t | y ) |
Sets the char at a specific position. WARNING: Internal Funcion, end user shouldn't use this.
The origin is top-left.
- Parameters
-
buf | The pointer to the struct libtui_buffer that was created with struct libtui_buffer *libtui_buffer_create(size_t column, size_t row). This function will modify the struct passed but it won't modify the pointer. |
c | The char value, the char at the given position will be setted. |
x | The x position of the char that should be setted. |
y | The y position of the char that should be setted. |