Round coordinates when drawing
This commit is contained in:
parent
cbb4b7884c
commit
e48e566dd2
12
app/main.c
12
app/main.c
@ -340,8 +340,8 @@ static void mapdraw(void)
|
||||
.h = TILESIZE,
|
||||
};
|
||||
const SDL_Rect dest = {
|
||||
.x = SCALE * (x - vpos.x),
|
||||
.y = SCALE * (y - vpos.y),
|
||||
.x = SCALE * (int)round(x - vpos.x),
|
||||
.y = SCALE * (int)round(y - vpos.y),
|
||||
.w = SCALE * TILESIZE,
|
||||
.h = SCALE * TILESIZE,
|
||||
};
|
||||
@ -395,8 +395,8 @@ static void entitydraw(entity_t *e, uint64_t t)
|
||||
e->src.x = e->animstep.x * frame + e->svarstep.x * e->svar;
|
||||
e->src.y = e->animstep.y * frame + e->svarstep.y * e->svar;
|
||||
SDL_Rect dest = {
|
||||
.x = SCALE * (e->pos.x - vpos.x - e->src.w / 2),
|
||||
.y = SCALE * (e->pos.y - vpos.y - e->src.h / 2),
|
||||
.x = SCALE * (int)round(e->pos.x - e->src.w / 2 - vpos.x),
|
||||
.y = SCALE * (int)round(e->pos.y - e->src.h / 2 - vpos.y),
|
||||
.w = SCALE * e->src.w,
|
||||
.h = SCALE * e->src.h,
|
||||
};
|
||||
@ -413,8 +413,8 @@ static void objsdraw(uint64_t t)
|
||||
SDL_Rect src = type->src;
|
||||
src.x += type->src.w * ((t / BASEANIMPERIOD) % type->animframes);
|
||||
SDL_Rect dest = {
|
||||
.x = SCALE * (obj->pos.x - vpos.x),
|
||||
.y = SCALE * (obj->pos.y - vpos.y - type->src.h),
|
||||
.x = SCALE * (int)round(obj->pos.x - vpos.x),
|
||||
.y = SCALE * (int)round(obj->pos.y - vpos.y - type->src.h),
|
||||
.w = SCALE * type->src.w,
|
||||
.h = SCALE * type->src.h,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user