cstring and csprite are working

This commit is contained in:
2025-02-18 15:28:17 -08:00
parent 993330a3a4
commit a77df22ffe
5 changed files with 46 additions and 41 deletions

View File

@@ -26,6 +26,13 @@ struct tart_window tart_create_window() {
return window;
}
tart_byte tart_restore_window(struct tart_window* window) {
for (int i = 0; i < window->data_count; i++) {
window->data[i] = '\0';
}
return TART_OK;
}
struct tart_buffer tart_create_buffer(tart_id id, struct tart_vec2 size, struct tart_vec2 position) {
unsigned int cell_count = size.x * size.y;
@@ -37,6 +44,7 @@ struct tart_buffer tart_create_buffer(tart_id id, struct tart_vec2 size, struct
unsigned int data_count = (size.x*size.y) * TART_CELL_DATA_SIZE;
struct tart_buffer buf = {cell_count,0,id,size,position,cells}; // -NOTE- dose not set the layer
buf.cell_count = cell_count;
return buf;
}
#ifdef TART_RGB_COLORS
@@ -174,7 +182,7 @@ tart_byte tart_csprite_free(struct tart_csprite* sprite) {
}
tart_byte tart_draw_cell_position(struct tart_buffer * buffer, struct tart_cell cell, struct tart_vec2 position) {
if(buffer->size.x >= position.x && buffer->size.y >= position.y) {
if(buffer->size.x > position.x && buffer->size.y > position.y) {
buffer->cells[(buffer->size.x * position.y) + position.x] = cell;
}
return TART_OK;
@@ -198,5 +206,8 @@ tart_byte tart_draw_csprite_position(struct tart_buffer * buffer, struct tart_cs
}
tart_byte tart_restore_buffer(struct tart_buffer *buffer) {
for (int i = 0; i < buffer->cell_count; i++) {
buffer->cells[i] = NULL_CELL;
}
return TART_OK;
}