summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2023-10-12 20:12:33 -0500
committercitrons <citrons@mondecitronne.com>2023-10-12 20:12:33 -0500
commit5ff2902259cc135375f526005a79d1e8cd83816b (patch)
treeaac0c93215ed1620cc080bfda668fd00b04707c8
parent034d7d3df700818d43b82bccd3bbb4babb2686e5 (diff)
explicitly round instead of adding 0.5
-rw-r--r--world.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/world.c b/world.c
index 8e22470..46407c3 100644
--- a/world.c
+++ b/world.c
@@ -233,8 +233,8 @@ void draw_world(world *w, SDL_Window *win, SDL_Renderer *rend) {
int draw_y = ((double) world_y - view_y) * view_scale;
SDL_Rect draw_rect = {
draw_x, draw_y,
- (double) CHUNK_DIM * view_scale + 0.5,
- (double) CHUNK_DIM * view_scale + 0.5,
+ SDL_round((double) CHUNK_DIM * view_scale),
+ SDL_round((double) CHUNK_DIM * view_scale),
};
SDL_RenderCopy(rend, tex, NULL, &draw_rect);
}
@@ -243,7 +243,7 @@ void draw_world(world *w, SDL_Window *win, SDL_Renderer *rend) {
int player_x = (w->player.pos.x - view_x) * view_scale;
int player_y = (w->player.pos.y - view_y) * view_scale;
SDL_Rect player_rect = {
- player_x, player_y, view_scale + 0.5, view_scale + 0.5,
+ player_x, player_y, SDL_round(view_scale), SDL_round(view_scale),
};
SDL_SetRenderDrawColor(rend, 0xFF, 0x00, 0xFF, 0xFF);
SDL_RenderFillRect(rend, &player_rect);