annotate stage_init.cc @ 21:fd9deaa67de9

debug done.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Mon, 18 Oct 2010 02:52:52 +0900
parents 632ce41a842a
children 3fb8a6a34e24
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_;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
7 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
8
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
9 crab->xyz[0] = charactor[1].x;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
10 crab->xyz[1] = charactor[1].y;
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_;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
29 SceneGraphPtr back;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
30 back = sgroot->createSceneGraph();
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
31
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
32 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
33 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
34 charactor[0].y = h/2;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
35 charactor[0].vx = 1.0;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
36 charactor[0].vy = 1.0;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
37 charactor[0].flag = 0;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
38 charactor[0].parent = (void*)back;
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
39
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
40 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
41 title->xyz[1] = charactor[0].y;
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
42
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
43 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
44 charactor[1].x = 0.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
45 charactor[1].y = 0.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
46 charactor[1].vx = 1.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
47 charactor[1].vy = 1.0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
48 charactor[1].flag = 0;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
49 charactor[1].parent = (void*)back;
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
50
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
51 crab->xyz[0] = charactor[1].x;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
52 crab->xyz[1] = charactor[1].y;
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
53
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
54 back->addChild(title);
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
55 // back->addChild(crab);
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
56 sgroot->setSceneData(back);
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
57
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
58 int size = sizeof(ObjProperty);
21
fd9deaa67de9 debug done.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
59 // sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab);
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
60 sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title);
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
61 }
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
62
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
63
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
64 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
65 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
66 {
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
67 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
68
19
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
69 SceneGraphPtr stage = sgroot->createSceneGraph();
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
70 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
71
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
72 //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
73 //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
74
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
75 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
76 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
77 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
78
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
79 stage->addChild(mydandy);
632ce41a842a testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
80 sgroot->setSceneData(stage);
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
81 }