cstring and csprite are working
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ char term_tinput() {
|
||||
return __term_input_buffer__[0];
|
||||
}
|
||||
void term_disable_cursor() {
|
||||
fputs("\033[?25l", stdout);
|
||||
printf("\033[?25l", stdout);
|
||||
}
|
||||
|
||||
void term_enable_cursor() {
|
||||
fputs("\033[?25h", stdout);
|
||||
printf("\033[?25h", stdout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user