Le support aux utilisateurs et les demandes de création de comptes externes doivent être faites depuis les issues du projet GitLab HEFR (https://gitlab.forge.hefr.ch/forge-hefr/gitlab-hefr)

Commit bc256b26 authored by Nicolas Maier's avatar Nicolas Maier
Browse files

Correction

parent 7081c6be
Pipeline #7176 failed with stage
in 14 seconds
......@@ -33,11 +33,12 @@
#include "timer.h"
#define GAME_TOPBOTTOM_MARGIN 4
#define GAME_BALL_DEFAULT_SPEED 0.01
#define GAME_BALL_DEFAULT_SPEED 0.05
#define REFRESH_MS 50
#define READY_WAIT_MS 2000
#define BAR_SPEED 2
#define BALL_START_OFFSET 10
#define STEP_COUNT_MAX 10
bool isJ1;
msgqid_t msgq;
......@@ -84,6 +85,8 @@ static void game_thread(void* param)
{
(void)param;
int step_count = STEP_COUNT_MAX;
while (1) {
while (true) {
void* msg = msgq_fetch(msgq);
......@@ -137,9 +140,11 @@ static void game_thread(void* param)
if (elapsed_time_2 >= REFRESH_MS) {
timer_get_counter(DMTIMER_2);
printf("Game refresh (elapsed %lu)\n", elapsed_time_2);
step_count--;
next_state.ally_pos = wheel_pos;
communication_sendBar(next_state.ally_pos);
if (step_count == 0)
communication_sendBar(next_state.ally_pos);
// Déplacement de la balle
next_state.ball_pos.x += next_state.ball_dir.x * next_state.ball_speed * elapsed_time_2;
......@@ -173,7 +178,8 @@ static void game_thread(void* param)
prepare_set();
}
} else {
//communication_sendBall(next_state.ball_pos.x, next_state.ball_pos.y, next_state.ball_dir.x, next_state.ball_dir.y);
if (step_count == 0)
communication_sendBall(next_state.ball_pos.x, next_state.ball_pos.y, next_state.ball_dir.x, next_state.ball_dir.y);
}
}
......@@ -195,6 +201,8 @@ static void game_thread(void* param)
display_ball(next_state.ball_pos.x, next_state.ball_pos.y,
former_state.ball_pos.x, former_state.ball_pos.y);
if (step_count == 0)
step_count = STEP_COUNT_MAX;
former_state = next_state;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment