52 lines
1019 B
C
52 lines
1019 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "display/mesh/quad.h"
|
|
#include "display/texture/texture.h"
|
|
|
|
#define SPRITEBATCH_SPRITES_MAX 1
|
|
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT)
|
|
|
|
|
|
typedef struct {
|
|
mesh_t mesh;
|
|
int32_t spriteCount;
|
|
texture_t *currentTexture;
|
|
meshvertex_t vertices[SPRITEBATCH_VERTEX_COUNT];
|
|
} spritebatch_t;
|
|
|
|
extern spritebatch_t SPRITEBATCH;
|
|
|
|
/**
|
|
* Initializes a sprite batch.
|
|
*
|
|
* @param spriteBatch The sprite batch to initialize.
|
|
*/
|
|
void spriteBatchInit();
|
|
|
|
void spriteBatchPush(
|
|
texture_t *texture,
|
|
const float_t minX,
|
|
const float_t minY,
|
|
const float_t maxX,
|
|
const float_t maxY,
|
|
const uint8_t r,
|
|
const uint8_t g,
|
|
const uint8_t b,
|
|
const uint8_t a,
|
|
const float_t u0,
|
|
const float_t v0,
|
|
const float_t u1,
|
|
const float_t v1
|
|
);
|
|
|
|
void spriteBatchClear();
|
|
|
|
void spriteBatchFlush();
|
|
|
|
void spriteBatchDispose(); |