comparison Renderer/Test/boss1_action.cc @ 557:ec72b601b71f

fix examlples (on going)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 22 Oct 2009 17:34:12 +0900
parents f6daf964f483
children b05bae017029
comparison
equal deleted inserted replaced
524:0f180d46db89 557:ec72b601b71f
1 #include "SGList.h" 1 #include "SceneGraphRoot.h"
2 #include "MainLoop.h"
2 #include "boss1_action.h" 3 #include "boss1_action.h"
3 4
4 /* 5 /*
5 static void 6 static void
6 null_move(SceneGraphPtr node, int screen_w, int screen_h) 7 null_move(SceneGraphPtr node, int screen_w, int screen_h)
200 node->remove(); 201 node->remove();
201 } 202 }
202 } 203 }
203 } 204 }
204 205
206 extern Application *
207 application() {
208 return new ball_bound();
209 }
210
211 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";
212
213
205 static void 214 static void
206 blast_move(SceneGraphPtr node, int screen_w, int screen_h) 215 blast_move(SceneGraphPtr node, int screen_w, int screen_h)
207 { 216 {
208 if(node->sgid > BLAST8) { 217 if(node->sgid > BLAST8) {
209 SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1); 218 SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1);
221 node->remove(); 230 node->remove();
222 } 231 }
223 node->frame += 1; 232 node->frame += 1;
224 } 233 }
225 234
226 void 235 MainLoopPtr
227 boss1_init(TaskManager *manager, int screen_w, int screen_h) 236 bass1_action::boss1_init(Viewer *sgroot, int screen_w, int screen_h)
228 { 237 {
229 SceneGraphPtr root;
230 SceneGraphPtr player;
231 SceneGraphPtr boss1;
232 SceneGraphPtr left_parts;
233 SceneGraphPtr right_parts;
234 238
235 sgroot->createFromXMLfile(manager, "xml_file/boss1.xml"); 239 sgroot->createFromXMLfile(manager, "xml_file/boss1.xml");
236 sgroot->createFromXMLfile(manager, "xml_file/player1.xml"); 240 sgroot->createFromXMLfile(manager, "xml_file/player1.xml");
237 sgroot->createFromXMLfile(manager, "xml_file/p_shot.xml"); 241 sgroot->createFromXMLfile(manager, "xml_file/p_shot.xml");
238 sgroot->createFromXMLfile(manager, "xml_file/blast.xml"); 242 sgroot->createFromXMLfile(manager, "xml_file/blast.xml");
239 243
240 //rootとなるSceneGraphを生成 244 //rootとなるSceneGraphを生成
241 root = sgroot->createSceneGraph(); 245 SceneGraphPtr root = sgroot->createSceneGraph();
242 246
243 //自機の初期化 247 //自機の初期化
244 player = sgroot->createSceneGraph(PLAYER); 248 SceneGraphPtr player = sgroot->createSceneGraph(PLAYER);
245 player->xyz[0] = screen_w/2; 249 player->xyz[0] = screen_w/2;
246 player->xyz[1] = screen_h - player_radius; 250 player->xyz[1] = screen_h - player_radius;
247 root->addChild(player); 251 root->addChild(player);
248 252
249 //ボスの初期化 253 //ボスの初期化
250 boss1 = sgroot->createSceneGraph(BOSS1); 254 SceneGraphPtr boss1 = sgroot->createSceneGraph(BOSS1);
251 boss1->xyz[0] = screen_w/2; 255 boss1->xyz[0] = screen_w/2;
252 boss1->xyz[1] = boss_radius_y; 256 boss1->xyz[1] = boss_radius_y;
253 // boss1->xyz[2] = first_boss1_depth; 257 // boss1->xyz[2] = first_boss1_depth;
254 boss1->stack_xyz[0] = first_boss1_speed; 258 boss1->stack_xyz[0] = first_boss1_speed;
255 root->addChild(boss1); 259 root->addChild(boss1);
256 260
257 //ボスの左右パーツを追加 261 //ボスの左右パーツを追加
258 left_parts = sgroot->createSceneGraph(BOSS1_L); 262 SceneGraphPtr left_parts = sgroot->createSceneGraph(BOSS1_L);
259 boss1->addChild(left_parts); 263 boss1->addChild(left_parts);
260 right_parts = sgroot->createSceneGraph(BOSS1_R); 264 SceneGraphPtr right_parts = sgroot->createSceneGraph(BOSS1_R);
261 boss1->addChild(right_parts); 265 boss1->addChild(right_parts);
262 266
263 //各機体の動きと当たり判定をセット 267 //各機体の動きと当たり判定をセット
264 player->set_move_collision(player_move, player_collision); 268 player->set_move_collision(player_move, player_collision);
265 boss1->set_move_collision(boss1_move_left, null_collision); 269 boss1->set_move_collision(boss1_move_left, null_collision);
266 270
267 //仕上げ 271 //仕上げ
268 sgroot->setSceneData(root); 272 sgroot->setSceneData(root);
269 } 273 return sgroot;
274 }
275
276 extern int init(TaskManager *manager, int argc, char *argv[]);
277 extern void task_initialize();
278 static void TMend(TaskManager *manager);
279
280 int
281 TMmain(TaskManager *manager, int argc, char *argv[])
282 {
283 task_initialize();
284 manager->set_TMend(TMend);
285 return init(manager, argc, argv);
286
287 }
288
289 void
290 TMend(TaskManager *manager)
291 {
292 printf("test_nogl end\n");
293 }
294
295