working on 250 color palet for cell
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "../includes/tart.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include "term.h"
|
||||
|
||||
struct tart_cell tart_test() {
|
||||
@@ -18,18 +20,28 @@ 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;
|
||||
struct tart_cell* cells = (struct tart_cell*)malloc((size.x * size.y) * sizeof(struct tart_cell));
|
||||
struct tart_cell cell = {.foreground = {0,0,0}, .background = {10,0,0}, .style = 0x0, .display = 0x0};
|
||||
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
|
||||
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};
|
||||
return b;
|
||||
}
|
||||
#else
|
||||
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
|
||||
tart_byte tart_add_buffer(struct tart_window* window, struct tart_buffer buffer) {
|
||||
window->buffers[window->buffer_count] = buffer;
|
||||
window->buffer_count++;
|
||||
return window->buffer_count;
|
||||
if(window->buffer_count <= 0xFF) {
|
||||
window->buffers[window->buffer_count] = buffer;
|
||||
window->buffer_count++;
|
||||
return window->buffer_count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
tart_byte tart_set_buffer(struct tart_window* window, struct tart_buffer buffer, tart_byte layer) {
|
||||
if(layer <= 0xFF) {
|
||||
@@ -52,3 +64,25 @@ struct tart_cell tart_set_cell(struct tart_buffer* buffer, struct tart_cell cell
|
||||
buffer->cells[idx] = 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user