added some more tests to render test and csprite is working
This commit is contained in:
@@ -160,6 +160,7 @@ struct tart_csprite tart_csprite(struct tart_cell* cells, struct tart_vec2* posi
|
||||
sprite.bounds.y = positions[i].y;
|
||||
}
|
||||
}
|
||||
sprite.size = size;
|
||||
return sprite;
|
||||
};
|
||||
|
||||
@@ -173,7 +174,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.y >= position.y && buffer->size.x >= position.x) {
|
||||
if(buffer->size.x >= position.x && buffer->size.y >= position.y) {
|
||||
buffer->cells[(buffer->size.x * position.y) + position.x] = cell;
|
||||
}
|
||||
return TART_OK;
|
||||
@@ -190,7 +191,7 @@ tart_byte tart_draw_cstring_position(struct tart_buffer *buffer, struct tart_cst
|
||||
|
||||
tart_byte tart_draw_csprite_position(struct tart_buffer * buffer, struct tart_csprite sprite, struct tart_vec2 basePosition) {
|
||||
for(int i = 0; i < sprite.size; i++) {
|
||||
struct tart_vec2 position = {sprite.position[i].x + basePosition.x, sprite.position[i].y + basePosition.y};
|
||||
struct tart_vec2 position = {sprite.position[i].x + basePosition.x, sprite.position[i].y + basePosition.y};
|
||||
tart_draw_cell_position(buffer, sprite.data[i], position);
|
||||
}
|
||||
return TART_OK;
|
||||
|
||||
Reference in New Issue
Block a user