diff options
Diffstat (limited to 'sources/TZR_DrawEnd.c')
-rw-r--r-- | sources/TZR_DrawEnd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sources/TZR_DrawEnd.c b/sources/TZR_DrawEnd.c index ba379be..38c8e1b 100644 --- a/sources/TZR_DrawEnd.c +++ b/sources/TZR_DrawEnd.c @@ -22,16 +22,16 @@ TZR_DrawEnd(void) const float ratio_w = win_w / (float)___tzr_config.width; const float ratio_h = win_h / (float)___tzr_config.height; - float scale = (ratio_w < ratio_h) ? ratio_w : ratio_h; - if (scale > 1.0f && ___tzr_config.pixel_perfect) - scale = (int)scale; - const int off_x = (win_w - ___tzr_config.width * scale) / 2; - const int off_y = (win_h - ___tzr_config.height * scale) / 2; + ___tzr_scale = (ratio_w < ratio_h) ? ratio_w : ratio_h; + if (___tzr_scale > 1.0f && ___tzr_config.pixel_perfect) + ___tzr_scale = (int)___tzr_scale; + ___tzr_off_x = (win_w - ___tzr_config.width * ___tzr_scale) / 2; + ___tzr_off_y = (win_h - ___tzr_config.height * ___tzr_scale) / 2; const SDL_Rect dest = { - off_x, - off_y, - ___tzr_config.width * scale, - ___tzr_config.height * scale + ___tzr_off_x, + ___tzr_off_y, + ___tzr_config.width * ___tzr_scale, + ___tzr_config.height * ___tzr_scale }; if (SDL_RenderCopy(___tzr_renderer, ___tzr_target, NULL, &dest) < 0) |