Skip to content

Commit a2bc3c6

Browse files
committed
More type stuff in pong clock sample
1 parent 9982a3f commit a2bc3c6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/samples/clock/pong.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ uint64_t pong_draw(struct pong *pong)
216216
if (pong->ball_y.pos >= 30.0 || pong->ball_y.pos <= 0.0)
217217
pong->ball_y.vel = -pong->ball_y.vel;
218218

219-
if (roundf(pong->ball_x.pos) == 40.0 + rand_double(13)) {
219+
if (round(pong->ball_x.pos) == 40.0 + rand_double(13)) {
220220
pong->player_left.target_y = pong->ball_y.pos - 3.0;
221221
clamp(&pong->player_left.target_y, 0.0, 24.0);
222-
} else if (roundf(pong->ball_x.pos) == 8 + rand_double(13)) {
222+
} else if (round(pong->ball_x.pos) == 8 + rand_double(13)) {
223223
pong->player_right.target_y = pong->ball_y.pos - 3.0;
224224
clamp(&pong->player_right.target_y, 0.0, 24.0);
225225
}
@@ -236,7 +236,7 @@ uint64_t pong_draw(struct pong *pong)
236236

237237
/* If the ball is in the middle, check if we need to lose and calculate
238238
* the endpoint to avoid/hit the ball */
239-
if (roundf(pong->ball_x.pos) == 32.0) {
239+
if (round(pong->ball_x.pos) == 32.0) {
240240
struct pong_time cur_time = {};
241241

242242
pong_time_update(&cur_time);
@@ -280,8 +280,8 @@ uint64_t pong_draw(struct pong *pong)
280280
memset(pong->gif->frame, 0, 64 * 32);
281281
pong_draw_net(pong);
282282
pong_draw_time(pong);
283-
pong_draw_player(pong, 0, pong->player_left.y);
284-
pong_draw_player(pong, 62, pong->player_right.y);
283+
pong_draw_player(pong, 0, (int)pong->player_left.y);
284+
pong_draw_player(pong, 62, (int)pong->player_right.y);
285285
pong_draw_ball(pong);
286286

287287
return 8;

0 commit comments

Comments
 (0)