diff Renderer/Test/ball_bound.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 a5fda4e51498
children 4f77768d7a7f
line wrap: on
line diff
--- a/Renderer/Test/ball_bound.cc	Sat Nov 21 11:20:29 2009 +0900
+++ b/Renderer/Test/ball_bound.cc	Wed Nov 25 21:56:14 2009 +0900
@@ -6,9 +6,9 @@
 
 
 // prototype
-static void ball_move(SceneGraphPtr node, int screen_w, int screen_h);
-static void ball_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree);
-static void ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree);
+static void ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h);
+static void ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, SceneGraphPtr tree);
+static void ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree);
 
 
 static float vy = 0.0f; // y 方向速度
@@ -24,8 +24,9 @@
 static float speed = 10.0f;
 
 static void
-ball_move_idle2(SceneGraphPtr node, int screen_w, int screen_h)
+ball_move_idle2(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
+    SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
     Pad *pad = sgroot->getController();
 
     if (pad->circle.isHold()) {
@@ -54,8 +55,9 @@
 static int time = 0;
 
 static void
-ball_move_idle(SceneGraphPtr node, int screen_w, int screen_h)
+ball_move_idle(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
+    SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
     Pad *pad = sgroot->getController();
 
     if (pad->circle.isPush()) {
@@ -77,7 +79,7 @@
 }
 
 static void
-ball_move(SceneGraphPtr node, int screen_w, int screen_h)
+ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
     vy += g * dt;
     node->xyz[1] += vy * dt;
@@ -85,12 +87,12 @@
 }
 
 static void
-ball_collision_idle(SceneGraphPtr, int w, int h, SceneGraphPtr tree)
+ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree)
 {
 }
 
 static void
-ball_collision(SceneGraphPtr node, int screen_w, int screen_h,
+ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
 			   SceneGraphPtr tree)
 {
     if (node->xyz[1] > screen_h - ball_radius) {
@@ -131,6 +133,12 @@
     return sgroot;
 }
 
+MainLoopPtr 
+ball_bound::init_only_sg(SgChange *sgroot, int screen_w, int screen_h)
+{
+    return sgroot;
+}
+
 extern Application *
 application() {
     return new ball_bound();