diff Renderer/Test/cube.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
line wrap: on
line diff
--- a/Renderer/Test/cube.cc	Sat Nov 21 11:20:29 2009 +0900
+++ b/Renderer/Test/cube.cc	Wed Nov 25 21:56:14 2009 +0900
@@ -4,16 +4,17 @@
 #define SELECT 2
 
 void
-cube_collision(SceneGraphPtr node, int screen_w, int screen_h,
+cube_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
                SceneGraphPtr tree)
 {
+    SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
     if (node->frame > 120) {
-      cube_split(node,tree);
+	cube_split(node,tree, sgroot);
     }
 }
 
 void
-cube_move_left(SceneGraphPtr node, int screen_w, int screen_h)
+cube_move_left(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
     node->xyz[0] -= node->stack_xyz[0];
     node->xyz[1] += node->stack_xyz[1];
@@ -36,7 +37,7 @@
 }
 
 void
-cube_move_right(SceneGraphPtr node, int screen_w, int screen_h)
+cube_move_right(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
     node->xyz[0] += node->stack_xyz[0];
     node->xyz[1] += node->stack_xyz[1];
@@ -55,7 +56,8 @@
 extern int enemy ;
 
 void
-cube_split(SceneGraphPtr root,SceneGraphPtr tree)
+cube_split(SceneGraphPtr root,SceneGraphPtr tree, SceneGraphRoot *sgroot
+)
 {
 
   SceneGraphPtr p;
@@ -134,7 +136,7 @@
 }
 
 void
-collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h)
+collision_purple(SceneGraphIteratorPtr it,SceneGraphPtr node,int w,int h, SceneGraphRoot *sgroot)
 {
   float dx, dy,ddx,ddy, r;
   float q = 0;
@@ -149,7 +151,7 @@
     ddy = dy*dy;
 
     if(sqrt(ddx) < 10 && sqrt(ddy) < 10) {
-      gameover_scene(w,h,mcube);
+	gameover_scene(w,h,mcube, sgroot);
       node->remove();
       break;
     }