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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
6 extern void task_init(void);
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
7
12
tkaito
parents: 11
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
14
1
7dc2d920fc7c local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents: 0
diff changeset
15 int
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
16 init(int argc, char **argv)
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
17 {
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
23 }
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
24 }
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
25
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
26 return 0;
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
27 }
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
28
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
29 void
11
tkaito
parents: 10
diff changeset
30 init_charactor(Viewer *sgroot, int w, int h)
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
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
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
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
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
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
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
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
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
65 int
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
66 TMmain(TaskManager *manager,int argc, char *argv[])
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
67 {
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
78 }