From f4176f2b85a4f8ab6b8182b7b573910ab78d8425 Mon Sep 17 00:00:00 2001 From: PreacherDHM Date: Sat, 25 Jan 2025 12:57:45 -0800 Subject: [PATCH] started writing tarts main structure --- includes/tart.h | 81 +++++++++++++++++++++++++++++++++++++ source/CMakeLists.txt | 1 + source/{tart.cpp => tart.c} | 0 3 files changed, 82 insertions(+) rename source/{tart.cpp => tart.c} (100%) diff --git a/includes/tart.h b/includes/tart.h index e69de29..7b70853 100644 --- a/includes/tart.h +++ b/includes/tart.h @@ -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); + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 67c486e..40ca748 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -3,3 +3,4 @@ set(Lib_SOURCES tart.cpp ) add_library(${PROJECT_NAME} STATIC ${LIB_SOURCES}) +target_include_directories(${PROJECT_NAME} BEFORE PUBLIC "../includes/") diff --git a/source/tart.cpp b/source/tart.c similarity index 100% rename from source/tart.cpp rename to source/tart.c