diff Renderer/Test/send_linda.cc @ 671:f42b303044f7

fix several Renderer/Test with (void*)sgroot.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 05 Dec 2009 17:26:58 +0900
parents 0eed1fa290c1
children 4dc02d3e98bb
line wrap: on
line diff
--- a/Renderer/Test/send_linda.cc	Thu Dec 03 09:02:40 2009 +0900
+++ b/Renderer/Test/send_linda.cc	Sat Dec 05 17:26:58 2009 +0900
@@ -46,8 +46,9 @@
 }
 
 void
-root_move(SceneGraphPtr node, int w, int h)
+root_move(SceneGraphPtr node, void *sgroot_, int w, int h)
 {
+    SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
     Pad *pad = sgroot->getController();
 	int flag = 0;
     if (pad->right.isHold() || pad->left.isHold()) {
@@ -79,17 +80,17 @@
 }
 
 void
-root_collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree)
+root_collision(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree)
 {
 }
 
 void
-move(SceneGraphPtr node, int w, int h)
+move(SceneGraphPtr node, void *sgroot_, int w, int h)
 {
 }
 
 void
-collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree)
+collision(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree)
 {
 }
 
@@ -155,35 +156,34 @@
     int serial;
     int xml_id;
 
-    SceneGraphPtr sgp;
-    SceneGraphPtr root;
 
 	// ここら辺長ったるいから、関数で分けるべきか...
 	
 	// root オブジェクト作成
-    root = sgroot->createSceneGraph();
+    SceneGraphPtr root = sgr->createSceneGraph();
 	// root_moveはコントローラーの入力で動き、座標をLinda Serverにout
     root->set_move_collision(root_move, root_collision);
 
 	// XMLをメモリにmapして、オブジェクト生成
     addr = file_map(xml, &size);
-	sgp = sgroot->createSceneGraph();
-    sgroot->createFromXMLmemory(sgroot->tmanager, sgp, (char *)addr, size);
+    SceneGraphPtr sgp = sgr->createSceneGraph();
+    sgr->createFromXMLmemory(sgp, (char *)addr, size);
     sgp->set_move_collision(move, collision);
 
 	// rootに接続
     root->addChild(sgp);
 
-	// Linda Serverに接続
-	tspace = open_linda_java(linda, PORT_NUM);
+    // Linda Serverに接続
+    tspace = open_linda_java(linda, PORT_NUM);
     // rootにLindaのfdを持たせる
-	root->propertyptr = sgroot->tmanager->allocate(sizeof(int));
-	root->property_size = sizeof(int);
-	*(int *)root->propertyptr = tspace;
+    root->propertyptr = (void*)malloc(sizeof(int));
+    int *p = (int*)root->propertyptr;
+    root->property_size = sizeof(int);
+    *p = tspace;
 
-	// このclientのserial_idを取得
-	serial = get_serial_id(tspace);
-	root->id = serial;
+    // このclientのserial_idを取得
+    serial = get_serial_id(tspace);
+    root->id = serial;
 
 	// ここから先の処理は、裏で何か動かせないかを考える
 	// とりあえず、関数に分けようか
@@ -209,11 +209,17 @@
 	// 初期化のin()
 	// send_position()でinの終了を確認する分岐が最初にあるため
 	root->seq = psx_in(tspace, pos_id);
-    sgroot->setSceneData(root);
+    sgr->setSceneData(root);
 	
     return sgr;
 }
 
+MainLoopPtr 
+send_linda::init_only_sg(SgChange *sgchange, int w, int h)
+{
+    return sgchange;
+}
+
 extern Application *
 application() {
     return new send_linda();