Mercurial > hg > Members > tkaito > task_dandy
annotate main.cc @ 19:632ce41a842a
testing game task with pad's input
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Aug 2010 03:37:36 +0900 |
parents | aecc2199251e |
children | fd9deaa67de9 |
rev | line source |
---|---|
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
1 #include "dandy.h" |
0 | 2 |
3 extern void task_init(void); | |
4 | |
12 | 5 TaskManager *manager; |
0 | 6 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
7 const char *usr_help_str = "Usage: ./twice [-length data_length] [-count task_num]\n\ |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
8 -length Number of data (default DATA_NUM (Func.h))\n\ |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
9 -count Number of task (default 1)\n"; |
0 | 10 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
11 int |
0 | 12 init(int argc, char **argv) |
13 { | |
14 for (int i = 1; argv[i]; ++i) { | |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
15 if (strcmp(argv[i], "-length") == 0) { |
6 | 16 //length = atoi(argv[++i]); |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
17 } else if (strcmp(argv[i], "-count") == 0) { |
6 | 18 //task = atoi(argv[++i]); |
0 | 19 } |
20 } | |
21 | |
22 return 0; | |
23 } | |
24 | |
2 | 25 #define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness} |
6 | 26 const state status[50] = ENEMY_STATUS_TABLE; |
2 | 27 |
28 void | |
11 | 29 init_charactor(Viewer *sgroot, int w, int h) |
2 | 30 { |
31 sgroot->createFromXMLfile("xml/mydandy.xml"); | |
32 sgroot->createFromXMLfile("xml/gameover.xml"); | |
33 sgroot->createFromXMLfile("xml/greencrab.xml"); | |
34 sgroot->createFromXMLfile("xml/bluebullet.xml"); | |
35 sgroot->createFromXMLfile("xml/redbullet.xml"); | |
36 sgroot->createFromXMLfile("xml/title2.xml"); | |
37 | |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
12
diff
changeset
|
38 for (int i = 0; i < ENEMY_NUM; i++) { |
8 | 39 charactor[i].root = (void*)sgroot->createSceneGraph(status[i].charano); |
40 charactor[i].score = status[i].score; | |
41 charactor[i].vital = status[i].vital; | |
4 | 42 } |
11 | 43 create_title_back(sgroot, w, h); |
2 | 44 } |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
45 |
7 | 46 ObjPropertyPtr charactor; |
47 | |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
48 MainLoopPtr |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
49 dandy::init(Viewer *sgroot, int w, int h) |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
50 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
12
diff
changeset
|
51 charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjPropertyPtr)*ENEMY_NUM); |
11 | 52 init_charactor(sgroot, w, h); |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
53 return sgroot; |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
54 } |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
55 |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
56 extern Application * |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
57 application() { |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
58 return new dandy(); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
59 } |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
60 |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
61 extern int init(TaskManager *manager, int argc, char *argv[]); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
62 extern void task_initialize(); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
63 static void TMend(TaskManager *manager); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
64 |
0 | 65 int |
66 TMmain(TaskManager *manager,int argc, char *argv[]) | |
67 { | |
6 | 68 /* |
0 | 69 if (init(argc, argv) < 0) { |
70 return -1; | |
71 } | |
6 | 72 */ |
0 | 73 // Task Register |
74 // ppe/task_init.cc | |
75 task_init(); | |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
76 /* |
0 | 77 for (int i = 0; i < task; ++i) { |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
78 twice_init(manager); |
0 | 79 } |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
80 */ |
3 | 81 //create_title(sgroot, w, h); |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
82 task_initialize(); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
83 manager->set_TMend(TMend); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
84 return init(manager,argc, argv); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
85 } |
0 | 86 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
87 void |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
88 TMend(TaskManager *manager) |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
89 { |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
90 printf("game end\n"); |
0 | 91 } |