Mercurial > hg > Members > tkaito > task_dandy
annotate main.cc @ 26:6bea374ee604
global alloc test.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 10 Dec 2010 02:20:37 +0900 |
parents | 3fb8a6a34e24 |
children |
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 |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
3 #define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness} |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
4 const state status[50] = ENEMY_STATUS_TABLE; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
5 |
0 | 6 extern void task_init(void); |
7 | |
12 | 8 TaskManager *manager; |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
9 ObjPropertyPtr charactor; |
0 | 10 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
11 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
|
12 -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
|
13 -count Number of task (default 1)\n"; |
0 | 14 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
15 int |
0 | 16 init(int argc, char **argv) |
17 { | |
18 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
|
19 if (strcmp(argv[i], "-length") == 0) { |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
20 //length = atoi(argv[++i]); |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
21 } else if (strcmp(argv[i], "-count") == 0) { |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
22 //task = atoi(argv[++i]); |
0 | 23 } |
24 } | |
25 | |
26 return 0; | |
27 } | |
28 | |
2 | 29 void |
11 | 30 init_charactor(Viewer *sgroot, int w, int h) |
2 | 31 { |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
32 sgroot->createFromXMLfile("xml/mydandy.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
33 sgroot->createFromXMLfile("xml/greencrab.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
34 sgroot->createFromXMLfile("xml/gameover.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
35 sgroot->createFromXMLfile("xml/greencrab.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
36 sgroot->createFromXMLfile("xml/bluebullet.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
37 sgroot->createFromXMLfile("xml/redbullet.xml"); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
38 sgroot->createFromXMLfile("xml/title2.xml"); |
2 | 39 |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
40 for (int i = 0; i < ENEMY_NUM; i++) { |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
41 charactor[i].root = (void*)sgroot->createSceneGraph(status[i].charano); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
42 charactor[i].score = status[i].score; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
43 charactor[i].vital = status[i].vital; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
44 } |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
45 create_title_back(sgroot, w, h); |
2 | 46 } |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
47 |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
48 MainLoopPtr |
21 | 49 Dandy::init(Viewer *sgroot, int w, int h) |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
50 { |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
51 charactor = (ObjPropertyPtr)sgroot->manager->allocate(sizeof(ObjProperty)*ENEMY_NUM); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
52 init_charactor(sgroot, w, h); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
53 return sgroot; |
1
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() { |
21 | 58 return new Dandy(); |
1
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 { | |
68 task_init(); | |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
69 task_initialize(); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
70 manager->set_TMend(TMend); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
71 return init(manager,argc, argv); |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
72 } |
0 | 73 |
1
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
74 void |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
75 TMend(TaskManager *manager) |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
76 { |
7dc2d920fc7c
local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents:
0
diff
changeset
|
77 printf("game end\n"); |
0 | 78 } |