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
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
3 extern void task_init(void);
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
4
12
tkaito
parents: 11
diff changeset
5 TaskManager *manager;
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
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 int
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
12 init(int argc, char **argv)
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
13 {
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 4
diff changeset
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
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 4
diff changeset
18 //task = atoi(argv[++i]);
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
19 }
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
20 }
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
21
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
22 return 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
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
25 #define ENEMY_STATUS(charano,score,hardness) {charano,score,hardness}
6
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 4
diff changeset
26 const state status[50] = ENEMY_STATUS_TABLE;
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
27
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
28 void
11
tkaito
parents: 10
diff changeset
29 init_charactor(Viewer *sgroot, int w, int h)
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
30 {
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
31 sgroot->createFromXMLfile("xml/mydandy.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
32 sgroot->createFromXMLfile("xml/gameover.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
33 sgroot->createFromXMLfile("xml/greencrab.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
34 sgroot->createFromXMLfile("xml/bluebullet.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
35 sgroot->createFromXMLfile("xml/redbullet.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
36 sgroot->createFromXMLfile("xml/title2.xml");
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
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
tkaito
parents: 7
diff changeset
39 charactor[i].root = (void*)sgroot->createSceneGraph(status[i].charano);
tkaito
parents: 7
diff changeset
40 charactor[i].score = status[i].score;
tkaito
parents: 7
diff changeset
41 charactor[i].vital = status[i].vital;
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
42 }
11
tkaito
parents: 10
diff changeset
43 create_title_back(sgroot, w, h);
2
6e1afe1016dc Task is not yet.
tkaito
parents: 1
diff changeset
44 }
1
7dc2d920fc7c local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents: 0
diff changeset
45
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
46 ObjPropertyPtr charactor;
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
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
tkaito
parents: 10
diff changeset
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
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 {
6
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 4
diff changeset
68 /*
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
69 if (init(argc, argv) < 0) {
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
70 return -1;
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
71 }
6
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 4
diff changeset
72 */
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
73 // Task Register
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
74 // ppe/task_init.cc
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
75 task_init();
1
7dc2d920fc7c local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents: 0
diff changeset
76 /*
0
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
79 }
1
7dc2d920fc7c local update. xml,image, blender add. ppe/move, ppe/coll add.
tkaito
parents: 0
diff changeset
80 */
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
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
e66ea5014aa1 first commit. But It move "Bulk".
tkaito
parents:
diff changeset
91 }