Built tileset logic

This commit is contained in:
2021-04-05 13:58:17 +10:00
parent 7ce4516399
commit 493477bf0d
12 changed files with 193 additions and 45 deletions

View File

@ -26,16 +26,16 @@ spritebatch_t * spriteBatchCreate(int32_t maxSprites) {
}
void spriteBatchQuad(spritebatch_t *spriteBatch, int32_t index,
float x, float y, float width, float height,
float x, float y, float z, float width, float height,
float u0, float v0, float u1, float v1
) {
if(index == -1) {
index = spriteBatch->currentSprite++;
} else {
spriteBatch->currentSprite = max(index, spriteBatch->currentSprite);
spriteBatch->currentSprite = mathMax(index, spriteBatch->currentSprite);
}
quadBuffer(spriteBatch->primitive,
quadBuffer(spriteBatch->primitive, z,
x, y, u0, v0,
x+width, y+height, u1, v1,
index*QUAD_VERTICE_COUNT, index*QUAD_INDICE_COUNT
@ -54,6 +54,6 @@ void spriteBatchDraw(spritebatch_t *spriteBatch, int32_t index, int32_t count) {
}
void spriteBatchDispose(spritebatch_t *spriteBatch) {
primitiveDispose(spriteBatch);
primitiveDispose(spriteBatch->primitive);
free(spriteBatch);
}