annotate stage_init.cc @ 23:3fb8a6a34e24

debug and keep up with task_array
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 26 Oct 2010 17:28:56 +0900
parents fd9deaa67de9
children a131729d6e4d 6bea374ee604
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
1 #include "dandy.h"
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
2
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
3 void
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
4 create_crab(SchedTask *s, void *charactor_, void *b)
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
5 {
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
6 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
7 SceneGraphPtr crab = (SceneGraphPtr)charactor->root;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
8
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
9 crab->xyz[0] = charactor->x;
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
10 crab->xyz[1] = charactor->y;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
11 }
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
12
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
13 void
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
14 create_title(SchedTask *s, void *charactor_, void *b)
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
15 {
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
16 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
17 SceneGraphPtr title = (SceneGraphPtr)charactor->root;
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
18
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
19 if (charactor->flag == 1) {
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
20 title->remove();
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
21 charactor->flag = 0;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
22 }
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
23 }
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
24
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
25 void
11
tkaito
parents: 10
diff changeset
26 create_title_back(Viewer *sgroot_, int w, int h)
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
27 {
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
28 Viewer *sgroot = sgroot_;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
29 SceneGraphPtr root = sgroot->createSceneGraph();
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
30
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
31 SceneGraphPtr title = (SceneGraphPtr)charactor[0].root;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
32 charactor[0].x = w/2;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
33 charactor[0].y = h/2;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
34 charactor[0].vx = 0.0;
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
35 charactor[0].vy = 0.0;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
36 charactor[0].flag = 0;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
37 charactor[0].parent = (void*)root;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
38
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
39 title->xyz[0] = charactor[0].x;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
40 title->xyz[1] = charactor[0].y;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
41
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
42 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
43 charactor[1].x = w/2;
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
44 charactor[1].y = h/2;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
45 charactor[1].vx = 1.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
46 charactor[1].vy = 1.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
47 charactor[1].flag = 0;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
48 charactor[1].parent = (void*)root;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
49
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
50 crab->xyz[0] = charactor[1].x;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
51 crab->xyz[1] = charactor[1].y;
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
52 crab->flag_drawable = 0;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
53
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
54 int size = sizeof(ObjProperty);
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
55 sgroot->task_array_init(TITLE_MOVE, TASK_NUM, PARAMETER, INDATA_NUM, OUTDATA_NUM);
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
56 sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title);
23
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
57 sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab);
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
58
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
59 root->addChild(title);
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
60 root->addChild(crab);
3fb8a6a34e24 debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
61 sgroot->setSceneData(root);
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
62 }
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
63
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
64
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
65 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
66 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
67 {
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
68 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
69
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
70 SceneGraphPtr stage = sgroot->createSceneGraph();
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
71 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
72
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
73 //mydandy->set_move_collision(dandy_move, dandy_coll);
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
74 //stage->set_move_collision(stage_move, stage_coll);
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
75
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
76 mydandy->xyz[0] = w/2;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
77 mydandy->xyz[1] = h*0.9;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
78 mydandy->xyz[2] = 0.0f;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
79
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
80 stage->addChild(mydandy);
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
81 sgroot->setSceneData(stage);
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
82 }