mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 15:55:22 +00:00
examples: Fix float division
This commit is contained in:
@@ -90,7 +90,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
||||
|
||||
/* ...and also fill a bunch of rectangles at once... */
|
||||
for (i = 0; i < SDL_arraysize(rects); i++) {
|
||||
const float w = (float) (WINDOW_WIDTH / SDL_arraysize(rects));
|
||||
const float w = ((float) WINDOW_WIDTH / SDL_arraysize(rects));
|
||||
const float h = i * 8.0f;
|
||||
rects[i].x = i * w;
|
||||
rects[i].y = WINDOW_HEIGHT - h;
|
||||
|
||||
@@ -66,7 +66,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
||||
SDL_SetRenderScale(renderer, 1.0f, 1.0f);
|
||||
SDL_RenderDebugText(renderer, 64, 350, "This only does ASCII chars. So this laughing emoji won't draw: 🤣");
|
||||
|
||||
SDL_RenderDebugTextFormat(renderer, (float) ((WINDOW_WIDTH - (charsize * 46)) / 2), 400, "(This program has been running for %" SDL_PRIu64 " seconds.)", SDL_GetTicks() / 1000);
|
||||
SDL_RenderDebugTextFormat(renderer, ((float) (WINDOW_WIDTH - (charsize * 46)) / 2), 400, "(This program has been running for %" SDL_PRIu64 " seconds.)", SDL_GetTicks() / 1000);
|
||||
|
||||
SDL_RenderPresent(renderer); /* put it all on the screen! */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user