Fix origin

This commit is contained in:
2024-01-28 17:49:32 +01:00
parent 205fb57f07
commit 77d6173962

View File

@@ -390,9 +390,9 @@ static void renderGame(Game *game, float dt) {
s[i].x, s[i].y};
DrawCircleV(p[i], 1.0f, BLUE);
Vector2 origin = {0.0f, 0.0f};
//dst.x += origin.x - dst.width * 0.5f;
//dst.y += origin.y - dst.height * 0.5f;
Vector2 origin = {dst.width * 0.5f, dst.height};
dst.x += origin.x;
dst.y += origin.y;
if (!CheckCollisionRecs(camBounds, dst))
continue;
Rectangle src = t[i].rec;
@@ -427,13 +427,13 @@ static void renderGame(Game *game, float dt) {
Texture2D tex = game->tileset.tiles;
for (i32 i = 0; i < numDraws; i++) {
DrawData draw = drawData[i];
Vector2 pos = {
draw.dst.x,
draw.dst.y,
};
Color c = WHITE;
if (draw.canHaveAlpha) {
Vec2i mapPos = bzTileMapPosToTile(map, pos);
Vector2 center = {
draw.dst.x,
draw.dst.y - draw.dst.height * 0.5f
};
Vec2i mapPos = bzTileMapPosToTile(map, center);
if (bzTileMapHasCollision(map, COLL_LAYER_TRANSPARENCY, mapPos.x, mapPos.y)) {
c.a = 180;
}