Mercurial > hg > Members > kono > Cerium
comparison Renderer/Test/ieshoot.cc @ 656:d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
author | hiroki@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Wed, 25 Nov 2009 21:56:14 +0900 |
parents | b21a013051a2 |
children | 4dc02d3e98bb |
comparison
equal
deleted
inserted
replaced
646:ffcc25c7c566 | 656:d0b8860c17f8 |
---|---|
11 static const float boss_radius_y = 128.0f; | 11 static const float boss_radius_y = 128.0f; |
12 | 12 |
13 static const float iebosstama_speed = 15.0f; | 13 static const float iebosstama_speed = 15.0f; |
14 | 14 |
15 static void | 15 static void |
16 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, | 16 ieboss_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, |
17 SceneGraphPtr tree); | 17 SceneGraphPtr tree); |
18 static void | 18 static void |
19 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree); | 19 ieboss_collision_invincibil(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, SceneGraphPtr tree); |
20 static void ieboss_move(SceneGraphPtr node, int screen_w, int screen_h); | 20 static void ieboss_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h); |
21 | 21 |
22 static void iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h); | 22 static void iebosstama_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h); |
23 | 23 |
24 | 24 |
25 static void | 25 static void |
26 iejiki_collision(SceneGraphPtr node, int screen_w, int screen_h, | 26 iejiki_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, |
27 SceneGraphPtr tree) | 27 SceneGraphPtr tree) |
28 { | 28 { |
29 } | 29 } |
30 | 30 |
31 static void | 31 static void |
32 ietama_collision(SceneGraphPtr node, int screen_w, int screen_h, | 32 ietama_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, |
33 SceneGraphPtr tree) | 33 SceneGraphPtr tree) |
34 { | 34 { |
35 } | 35 } |
36 | 36 |
37 static void | 37 static void |
38 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h, | 38 ieboss_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, |
39 SceneGraphPtr tree) | 39 SceneGraphPtr tree) |
40 { | 40 { |
41 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; | |
41 SceneGraphIteratorPtr it = sgroot->getIterator(tree); | 42 SceneGraphIteratorPtr it = sgroot->getIterator(tree); |
42 static int damage = 0; | 43 static int damage = 0; |
43 int ietama = sgroot->getSgid("IETAMA"); | 44 int ietama = sgroot->getSgid("IETAMA"); |
44 for (; it->hasNext(ietama);) { | 45 for (; it->hasNext(ietama);) { |
45 it->next(ietama); | 46 it->next(ietama); |
67 node->remove(); | 68 node->remove(); |
68 } | 69 } |
69 } | 70 } |
70 | 71 |
71 static void | 72 static void |
72 ieboss_move(SceneGraphPtr node, int screen_w, int screen_h) | 73 ieboss_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
73 { | 74 { |
74 /** | 75 /** |
75 * TODO | 76 * TODO |
76 * Boss が複数居た場合、これじゃ駄目 | 77 * Boss が複数居た場合、これじゃ駄目 |
77 */ | 78 */ |
97 z_speed = -z_speed; | 98 z_speed = -z_speed; |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
101 static void | 102 static void |
102 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, | 103 ieboss_collision_invincibil(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, |
103 SceneGraphPtr tree) | 104 SceneGraphPtr tree) |
104 { | 105 { |
105 static int frame = 0; | 106 static int frame = 0; |
106 | 107 |
107 frame++; | 108 frame++; |
114 node->set_move_collision(ieboss_move, ieboss_collision); | 115 node->set_move_collision(ieboss_move, ieboss_collision); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 static void | 119 static void |
119 iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h) | 120 iebosstama_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
120 { | 121 { |
121 node->xyz[1] += iebosstama_speed; | 122 node->xyz[1] += iebosstama_speed; |
122 | 123 |
123 // 描画領域から抜けたら削除 | 124 // 描画領域から抜けたら削除 |
124 if (node->xyz[1] > screen_h) { | 125 if (node->xyz[1] > screen_h) { |
125 node->remove(); | 126 node->remove(); |
126 } | 127 } |
127 } | 128 } |
128 | 129 |
129 static void | 130 static void |
130 ietama_move(SceneGraphPtr node, int screen_w, int screen_h) | 131 ietama_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
131 { | 132 { |
132 node->xyz[1] -= tama_speed; | 133 node->xyz[1] -= tama_speed; |
133 | 134 |
134 // 描画領域から抜けたら削除 | 135 // 描画領域から抜けたら削除 |
135 if (node->xyz[1] < 0) { | 136 if (node->xyz[1] < 0) { |
136 node->remove(); | 137 node->remove(); |
137 } | 138 } |
138 } | 139 } |
139 | 140 |
140 static void | 141 static void |
141 iejiki_move(SceneGraphPtr node, int screen_w, int screen_h) | 142 iejiki_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
142 { | 143 { |
144 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; | |
143 Pad *pad = sgroot->getController(); | 145 Pad *pad = sgroot->getController(); |
144 | 146 |
145 if (pad->left.isPush() | 147 if (pad->left.isPush() |
146 || pad->left.isHold()) { | 148 || pad->left.isHold()) { |
147 node->xyz[0] -= jiki_speed; | 149 node->xyz[0] -= jiki_speed; |
214 | 216 |
215 sgroot->setSceneData(back); | 217 sgroot->setSceneData(back); |
216 return sgroot; | 218 return sgroot; |
217 } | 219 } |
218 | 220 |
221 MainLoopPtr | |
222 ieshoot::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) | |
223 { | |
224 return sgroot; | |
225 } | |
226 | |
219 extern Application * | 227 extern Application * |
220 application() { | 228 application() { |
221 return new ieshoot(); | 229 return new ieshoot(); |
222 } | 230 } |
223 | 231 |