Mercurial > hg > old > magoroku_racing
annotate game.cc @ 117:9e4100c5d7ec
keybord input
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Jun 2011 14:42:55 +0900 |
parents | ed702e49cc6c |
children | f2e2460b4011 |
rev | line source |
---|---|
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
1 /* game.c */ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
2 |
0 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
5 #include <stdbool.h> |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
6 #include "libps2.h" |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
7 #include "ps2util.h" |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
8 #include "controler.h" |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
9 //#include "linda/lindaapi.h" |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
10 #include "game.h" |
0 | 11 #include "car.h" |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
12 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
13 #include "schedule.h" |
0 | 14 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
15 |
117 | 16 extern bool padCheck(SDL_Joystick *joy); |
17 extern bool keybord(void); | |
18 | |
19 | |
20 | |
0 | 21 /* linda.c */ |
22 #ifdef LINDA | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
23 //extern int linda_init(); |
47 | 24 #else |
117 | 25 #define linda_init() 1 |
0 | 26 #endif |
27 | |
117 | 28 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
29 void game_main() |
0 | 30 { |
98 | 31 Game game; |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
32 bool flg = true; |
117 | 33 //#ifdef LINDA |
34 game.play_id = linda_init(); | |
35 //#endif | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
36 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
37 while (1) { |
108
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
38 /* |
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
39 引数の数を変更したので、 |
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
40 エラーが出ないように一時的に削除 |
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
41 たぶん、後で新しく新調するはずなので・・・ |
109
165b4d902ca4
Error is corrected game.h and car.h
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
108
diff
changeset
|
42 代わりに、お試しkeybordを入れてみる。 |
108
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
43 */ |
68e6cc686f48
delete error of controler.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
44 //flg = padCheck(); |
109
165b4d902ca4
Error is corrected game.h and car.h
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
108
diff
changeset
|
45 flg = keybord(); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
46 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
47 if (flg == false) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
48 break; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
49 } |
116 | 50 |
98 | 51 schedule(&game); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
52 |
0 | 53 #ifdef LINDA |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
54 psx_sync_n(); |
0 | 55 #endif |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
90
diff
changeset
|
56 } |
0 | 57 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
58 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
59 //ceriumのmainルーチンに直す。 |