started writing tarts main structure

This commit is contained in:
2025-01-25 12:57:45 -08:00
parent c21f056b62
commit f4176f2b85
3 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
// #========================================================================#
// | PreacherDHM:TART
// |
// | Tarts stands for Terminal Art. Tart is a terminal renderer that uses a |
// | render buffer like system that takes csprites or character sprites and |
// | displays them in the terminal. The render buffer consists of cells and |
// | each cell consists of
// | - Color
// | - Rendered Character
// | - Reset
// | In toaltol around 19 to 24 bytes. This alows for complete controle |
// | over each cell.
// #========================================================================#
typedef unsigned char tart_byte;
typedef unsigned short tart_id;
struct tart_vec2 {
short x,y;
};
/* Tart Cell
*
* This holds a rgb for the foreground and the background.
* Includeing the display character.
*
*/
struct tart_cell {
tart_byte fr,fg,fb;
tart_byte br,bg,bb;
tart_byte style;
char display;
};
/* Tart Buffer
*
* The Buffer is a contner that holds all of the cells for that buffer.
* Allso containes the size of the buffer.
*
* ........................width...............
* ..........<-------------------------------->
*
* ........^ @################################@
*
* ........| #................................#
*
* ........| #................................#
*
* height--| #..........buffer................#
*
* ........| #................................#
*
* ........| #................................#
*
* ........V @################################@
*/
struct tart_buffer {
int cell_count;
tart_byte layer;
tart_vec2 size;
tart_vec2 position;
tart_id id;
struct cell* cells;
};
struct tart_render_manager {
struct tart_buffer buffers[sizeof(tart_byte)];
tart_byte buffer_count;
};
tart_buffer tart_create_buffer(tart_id, struct tart_vec2, struct tart_vect2);
tart_cell tart_create_cell(char, tart_byte, tart_byte, tart_byte, tart_byte, tart_byte, tart_byte);
tart_byte tart_add_buffer(struct tart_render_manager*, struct tart_buffer);
tart_byte tart_set_buffer(struct tart_render_manager*, struct tart_buffer, tart_byte);
tart_buffer& tart_get_buffer(struct tart_render_manager*, tart_byte);
tart_cell& tart_get_cell(struct tart_buffer*, int);
tart_cell tart_set_cell(struct tart_buffer*, tart_cell,int);

View File

@@ -3,3 +3,4 @@ set(Lib_SOURCES
tart.cpp
)
add_library(${PROJECT_NAME} STATIC ${LIB_SOURCES})
target_include_directories(${PROJECT_NAME} BEFORE PUBLIC "../includes/")