Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1664 pj 1
TASK Update(void* arg)
2
{
3
int iTimer = 100;
4
int oldTimer = 100;
5
int iOldScore = iScore;
6
char cScore[4];
7
while(1)
8
{
9
 
10
 mutex_lock(&grx_mutex);
11
 
12
 grx_text("Timer:",0,0,RED,WHITE);
13
 FAB_image_put_within(image_bg,0,0,50,0,50 + oldTimer,10);
14
 grx_box(50,0, 50 + iTimer,10,RED);
15
 
16
 mutex_lock(&player_mutex);
17
 grx_text("Score:",350,0,RED,WHITE);
18
 grx_box(400,0, 400 + iScore,10,RED);
19
 FAB_image_put_within(image_bg,0,0,400 + iOldScore,10,400 + iOldScore + 50,20);
20
 sprintf(cScore,"%d",iScore);
21
 grx_text(cScore,400 + iScore,10,RED,WHITE);
22
 iOldScore = iScore;
23
 mutex_unlock(&player_mutex);
24
 
25
 mutex_unlock(&grx_mutex);
26
 
27
 oldTimer = iTimer;
28
 --iTimer;
29
 if (iTimer == 0)
30
 {
31
  sys_end();
32
 }
33
 task_endcycle();
34
}
35
}
36
 
37
void CreateAndActivateScorerTask()
38
{
39
  HARD_TASK_MODEL   m;
40
  PID  update;
41
  hard_task_default_model(m);
42
  hard_task_def_wcet(m,UPDATE_WCET);
43
  hard_task_def_mit(m,UPDATE_PERIOD);
44
  hard_task_def_usemath(m);
45
  update = task_create("Update", Update, &m, NULL);
46
  if (update != NIL) task_activate(update);
47
  return;
48
}
49