Fix origin
This commit is contained in:
16
game/main.c
16
game/main.c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user