Added rgb build option/definition

This commit is contained in:
2025-02-01 12:49:17 -08:00
parent 3040b8ac5a
commit 4d81feab16
3 changed files with 48 additions and 35 deletions

View File

@@ -5,7 +5,11 @@
#include "term.h"
struct tart_cell tart_test() {
return (struct tart_cell){{0,0,0}, {0,0,0}, 0, 't'};
#ifdef TART_RGB_COLORS
return (struct tart_cell){{0,0,0}, {0,0,0}, 0, 't',0};
#else
return (struct tart_cell){0,0,0,0,0};
#endif
}
struct tart_window tart_create_window() {
struct tart_window window;
@@ -18,20 +22,23 @@ struct tart_window tart_create_window() {
}
struct tart_buffer tart_create_buffer(tart_id id, struct tart_vec2 size, struct tart_vec2 position) {
unsigned int cell_count = position.x * position.y;
unsigned int cell_count = size.x * size.y;
struct tart_cell* cells = (struct tart_cell*)malloc((size.x * size.y) * sizeof(struct tart_cell));
memset(&cells,0, size.x * size.y);
struct tart_cell cell = NULL_CELL;
struct tart_buffer buf = {cell_count,0,id,size,position,cells}; // -NOTE- dose not set the layer
char* data = (char*)malloc((size.x*size.y) * (sizeof(char) * TART_CELL_DATA_SIZE));
unsigned int data_count = (size.x*size.y) * TART_CELL_DATA_SIZE;
struct tart_buffer buf = {cell_count,0,id,size,position,cells, data, data_count}; // -NOTE- dose not set the layer
return buf;
}
#ifdef TART_RGB_COLORS
struct tart_cell tart_create_cell(char display, tart_byte style, struct tart_rgb foreground, struct tart_rgb background) {
struct tart_cell b = {foreground, background, style, display};
struct tart_cell b = {foreground, background, style, display,0};
return b;
}
#else
struct tart_cell tart_create_cell(char display, tart_byte style, tart_byte foreground, tart_byte background) {
struct tart_cell tart_create_cell(char display, tart_byte style,
tart_byte foreground, tart_byte background) {
return (struct tart_cell){foreground,background,style,display,0};
}
#endif
@@ -65,24 +72,3 @@ struct tart_cell tart_set_cell(struct tart_buffer* buffer, struct tart_cell cell
return c;
}
int render_cell(struct tart_cell* cell, char* cell_buffer, unsigned char buffer_size) {
unsigned char cell_size = 10;
#ifdef TART_RGB_PALET
sprintf(cell_buffer, "\x1b[%i;%i;%im%c\x1b[0m",cell->style, cell->foreground.r, cell->background.r, cell->display);
#endif
return TART_OK;
}
int tart_render(struct tart_buffer* buffer) {
for(int i = 0; i < buffer->cell_count; i++) {
for(int y = 0; y < buffer->size.x; y++) {
for(int x = 0; x < buffer->size.x; x++) {
}
}
}
return 0;
}