Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/**************** Functions called by keyboard handler*********/
2
#include <drivers/keyb.h>
3
#include <drivers/glib.h>
4
#include <drivers/glib.h>
5
#include <stdlib.h>
6
#include <string.h>
7
#include "include/simcity.h"
8
#include "include/proc.h"
9
 
10
short maxc=0;
11
char sens=0;
12
 
13
extern starting_set starting_set_array[S_POINT];
14
 
15
void h_car_create(KEY_EVT *k)
16
{
17
  char name[10];
18
  int num;
19
 
20
  if((maxc<MAX_CAR)) {
21
    num=add();
22
    if(num>=0) {
23
      sprintf(name,"car%d",num);
24
      h_create(name,num);
25
      sprintf(name,"camera%d",num);
26
      cam_create(name,num);
27
      sprintf(name,"speed%d",num);
28
      gauge_create(name,num);
29
      sprintf(name,"arrow%d",num);
30
      arrow_create(name,num);
31
    }
32
  }
33
}
34
 
35
void s_car_create(KEY_EVT *k)
36
{
37
  char name[10];
38
  int num;
39
 
40
  if((maxc<MAX_CAR)) {
41
    num=add();
42
    if(num>=0) {
43
      sprintf(name,"car%d",num);
44
      h_create(name,num);
45
      sprintf(name,"camera%d",num);
46
      cam_create(name,num);
47
      sprintf(name,"speed%d",num);
48
      gauge_create(name,num);
49
      sprintf(name,"arrow%d",num);
50
      arrow_create(name,num);
51
    }
52
  }
53
}
54
 
55
void h_car_kill(KEY_EVT *k) {
56
  int num;
57
 
58
  if(maxc>0) {
59
    num=del_o();
60
    if(num>=0) {
61
      killing(num);
62
    }
63
  }
64
}
65
 
66
void endfun(KEY_EVT *k)
67
{
68
  grx_close();
69
  cprintf("Brk command pressed! Ending...\n");
70
  sys_end();
71
}
72
 
73
void refresh(KEY_EVT *k){
74
 
75
  sem_wait(&mutex);
76
//heavy and obsolete.....
77
//draw_scenario();
78
  grx_putimage(MAPX,MAPY,MAPX+W-1,MAPY+H-1,street);
79
  sem_post(&mutex);
80
}
81
 
82
void sensor_switch(KEY_EVT *k) {
83
  if(sens==0) sens=1;
84
  else sens=0;
85
}