Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

TASK Update(void* arg)
{
int iTimer = 100;
int oldTimer = 100;
int iOldScore = iScore;
char cScore[4];
while(1)
{

 mutex_lock(&grx_mutex);

 grx_text("Timer:",0,0,RED,WHITE);
 FAB_image_put_within(image_bg,0,0,50,0,50 + oldTimer,10);
 grx_box(50,0, 50 + iTimer,10,RED);

 mutex_lock(&player_mutex);
 grx_text("Score:",350,0,RED,WHITE);
 grx_box(400,0, 400 + iScore,10,RED);
 FAB_image_put_within(image_bg,0,0,400 + iOldScore,10,400 + iOldScore + 50,20);
 sprintf(cScore,"%d",iScore);
 grx_text(cScore,400 + iScore,10,RED,WHITE);
 iOldScore = iScore;
 mutex_unlock(&player_mutex);

 mutex_unlock(&grx_mutex);

 oldTimer = iTimer;
 --iTimer;
 if (iTimer == 0)
 {
  sys_end();
 }
 task_endcycle();
}
}

void CreateAndActivateScorerTask()
{
  HARD_TASK_MODEL   m;
  PID  update;
  hard_task_default_model(m);
  hard_task_def_wcet(m,UPDATE_WCET);
  hard_task_def_mit(m,UPDATE_PERIOD);
  hard_task_def_usemath(m);
  update = task_create("Update", Update, &m, NULL);
  if (update != NIL) task_activate(update);
  return;
}