Remove texture from DrawData
This commit is contained in:
@@ -14,7 +14,6 @@ typedef enum GameScreen {
|
|||||||
} GameScreen;
|
} GameScreen;
|
||||||
|
|
||||||
typedef struct DrawData {
|
typedef struct DrawData {
|
||||||
Texture tex;
|
|
||||||
Rectangle src;
|
Rectangle src;
|
||||||
Rectangle dst;
|
Rectangle dst;
|
||||||
Vector2 origin;
|
Vector2 origin;
|
||||||
|
|||||||
@@ -381,7 +381,6 @@ static void renderGame(Game *game, float dt) {
|
|||||||
if (t[i].flipX) src.width *= -1.0f;
|
if (t[i].flipX) src.width *= -1.0f;
|
||||||
if (t[i].flipY) src.height *= -1.0f;
|
if (t[i].flipY) src.height *= -1.0f;
|
||||||
drawData[drawIdx++] = (DrawData) {
|
drawData[drawIdx++] = (DrawData) {
|
||||||
.tex = t[i].texture,
|
|
||||||
.src = src,
|
.src = src,
|
||||||
.dst = dst,
|
.dst = dst,
|
||||||
.origin = origin,
|
.origin = origin,
|
||||||
@@ -392,9 +391,10 @@ static void renderGame(Game *game, float dt) {
|
|||||||
BZ_ASSERT(drawIdx == numDraws);
|
BZ_ASSERT(drawIdx == numDraws);
|
||||||
qsort(drawData, numDraws, sizeof(*drawData), cmpDrawData);
|
qsort(drawData, numDraws, sizeof(*drawData), cmpDrawData);
|
||||||
|
|
||||||
|
Texture2D tex = game->tileset.tiles;
|
||||||
for (i32 i = 0; i < numDraws; i++) {
|
for (i32 i = 0; i < numDraws; i++) {
|
||||||
DrawData draw = drawData[i];
|
DrawData draw = drawData[i];
|
||||||
DrawTexturePro(draw.tex, draw.src, draw.dst, draw.origin, draw.rotation, WHITE);
|
DrawTexturePro(tex, draw.src, draw.dst, draw.origin, draw.rotation, WHITE);
|
||||||
}
|
}
|
||||||
Vector2 target = GetMousePosition();
|
Vector2 target = GetMousePosition();
|
||||||
target = GetScreenToWorld2D(target, game->camera);
|
target = GetScreenToWorld2D(target, game->camera);
|
||||||
|
|||||||
Reference in New Issue
Block a user