changeset 431:e8f2eed4042a

fix
author game@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 24 Sep 2009 20:43:14 +0900
parents b3d997c05c9e
children 481089375622
files TaskManager/Test/test_render/Application.h TaskManager/Test/test_render/Application/chain.cc TaskManager/Test/test_render/viewer.cc TaskManager/Test/test_render/viewer.h
diffstat 4 files changed, 35 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/Application.h	Thu Sep 24 17:45:35 2009 +0900
+++ b/TaskManager/Test/test_render/Application.h	Thu Sep 24 20:43:14 2009 +0900
@@ -1,8 +1,10 @@
 #ifndef INCLUDED_APPLICATION
 #define INCLUDED_APPLICATION
 
+#include "SceneGraph.h"
+
 typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h);
-typedef void (*coll_func)(SceneGraph* node, int screen_w, int screen_h);
+typedef void (*coll_func)(SceneGraph* node, int screen_w, int screen_h, SceneGraphPtr tree);
 
 class Application {
 public:
@@ -13,8 +15,10 @@
 
     void set_move_func(move_func move);
     void set_coll_func(coll_func coll);
-    SceneGraphPtr scenegraph_factory(PropertyPtr p);
-    SceneGraphPtr scenegraph_connector(PropertyPtr p,SceneGraphPtr s);
+//    SceneGraphPtr scenegraph_factory(PropertyPtr p);
+//    SceneGraphPtr scenegraph_connector(PropertyPtr p,SceneGraphPtr s);
+    SceneGraphPtr scenegraph_factory(void *p, int size);
+    SceneGraphPtr scenegraph_connector(void *p, int size, SceneGraphPtr s);
 
     move_func move;
     coll_func coll;
--- a/TaskManager/Test/test_render/Application/chain.cc	Thu Sep 24 17:45:35 2009 +0900
+++ b/TaskManager/Test/test_render/Application/chain.cc	Thu Sep 24 20:43:14 2009 +0900
@@ -19,19 +19,20 @@
     int can_move;
     SceneGraphPtr parent;
     int id;
-    //int parent;
-} CHAIN_VARS;
+    int parent_id;
+} PropertyPtr*;
 
 /* SceneGraph の property */
-CHAIN_VARS* properties[2];
-CHAIN_VARS* property;
+PropertyPtr properties[2];
+PropertyPtr property;
+
 
 
 //void createSceneGraphFromProperty(CHAIN_VARS* p) ;
 void createSceneGraphFromProperty(void* p) ;
 
 void
-init_chain_vars(CHAIN_VARS *cv) {
+Chain::init_chain_vars(CHAIN_VARS *cv) {
     cv->x = 0, cv->y = 0, cv->next_x = 0, cv->next_y = 0;
     cv->vx = 0, cv->vy = 0, cv->next_vx = 0, cv->next_vy = 0;
     cv->can_move = TRUE;
@@ -47,7 +48,7 @@
     sg->angle[2] = p->angle[2];
 }
 
-
+/*
 static void
 chain_move_ope(SceneGraphPtr node, int screen_w, int screen_h)
 {
@@ -70,14 +71,15 @@
         property[CHAIN_LEN-1].can_move = TRUE;
     }
 }
+*/
 
 void
-chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h)
+Chain::chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h)
 {
     int id = sg->id;
-    //CHAIN_VARS* p = (CHAIN_VARS*)sg->propertyptr;
+    //PropertyPtr p = (PropertyPtr)sg->propertyptr;
     HTaskPtr chain_cal;
-    CHAIN_VARS* output;
+    PropertyPtr output;
 
     // SceneGraph の切り替えもここでやる
     if (property == properties[0]) {
@@ -97,15 +99,14 @@
 }
 
 void
-chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg)
+Chain::chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg)
 {
-
 }
 
 void 
 createSceneGraphFromProperty(void* p) 
 {
-    CHAIN_VARS* chain_p = (CHAIN_VARS*)p;
+    PropertyPtr chain_p = (PropertyPtr)p;
     SceneGraphPtr chain_copy = sgroot->createSceneGraph(CHAIN);
     chain_copy->propertyptr = (void*)chain_p;
     chain_copy->property_size = sizeof(CHAIN_VARS);
@@ -114,7 +115,7 @@
 }
 
 void
-chain_init(TaskManager *manager, int w, int h)
+Chain::chain_init(TaskManager *manager, int w, int h)
 {
     SceneGraphPtr root_chain, chain;
     CHAIN_VARS rcv;
@@ -125,8 +126,8 @@
     sgroot->createFromXMLfile(manager, "xml_file/chain.xml");
 
     /* SPE に送る property の配列の領域確保 */
-    properties[0] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN);
-    properties[1] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN);
+    properties[0] = (PropertyPtr)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN);
+    properties[1] = (PropertyPtr)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN);
     property = properties[0];
 
     root_chain = sgroot->createSceneGraph(CHAIN);
--- a/TaskManager/Test/test_render/viewer.cc	Thu Sep 24 17:45:35 2009 +0900
+++ b/TaskManager/Test/test_render/viewer.cc	Thu Sep 24 20:43:14 2009 +0900
@@ -100,7 +100,6 @@
 extern void init_position(TaskManager *manager, int, int);
 extern void vacuum_init(TaskManager *manager, int w, int h);
 extern void untitled_init(TaskManager *manager);
-extern void chain_init(TaskManager *manager, int w, int h);
 extern void chain_old_init(TaskManager *manager, int w, int h);
 extern void boss1_init(TaskManager *manager, int w, int h);
 extern void init_gaplant(TaskManager *manager, int w, int h);
@@ -109,7 +108,7 @@
 void
 Viewer::run_init(TaskManager *manager, const char *xml, int sg_number)
 {
-    Application application = new Application();
+    Application application;
     this->manager = manager;
 
     start_time = get_ticks();
@@ -164,8 +163,10 @@
 	vacuum_init2(manager, this->width, this->height);
         break;
     case 16:
-        chain_init(manager, this->width, this-> height);
-	speLoop();
+        //chain_init(manager, this->width, this-> height);
+	application = new Chain();
+	application->chain_init(manager, this->width, this->height);
+	speInit();
 	return;
         break;
     case 17:
@@ -176,7 +177,7 @@
         break;
     }   
 
-    mainLoop();
+    mainInit();
 }
 
 
@@ -233,7 +234,7 @@
 
 /* Loop って言っても1回しか実行されない */
 void
-Viewer::speLoop()
+Viewer::speInit()
 {
     HTaskPtr task_next = initLoop();
     // key の情報を格納する領域を確保する (global_alloc(KEY_STATUS))
@@ -244,13 +245,6 @@
     key_stat *key = (key_stat*)manager->allocate(sizeof(key_stat));    
     this->keyPtr = key;
 
-    // post2runLoop は旧バージョン用なので post2speRunLoop の様なものを別につくるべき
-    //task_next->set_post(post2speRunLoop, (void*)this); // set_post(function(this->run_loop()), NULL)
-    //task_next->spawn();
-    // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
-
-    /* test */
-   
     HTaskPtr task_switch = manager->create_task(TASK_SWITCH);
     task_switch->wait_for(task_next);
     task_switch->set_post(post2runMoveDrawLoop, (void*)this);
@@ -319,9 +313,10 @@
     /* TASK_MOVE は外から引数で取ってくるべき */
     //HTaskPtr move_task = viewer->manager->create_task(viewer->move_taskid);    
     HTaskPtr move_task = viewer->manager->create_task(TASK_MOVE);
-    //move_task->add_param(sgroot);
+    move_task->add_param(sgroot_2);
 
     HTaskPtr draw_task = viewer->manager->create_task(TASK_DRAW);
+    move_task->add_param(sgroot);
 
     HTaskPtr switch_task = viewer->manager->create_task(TASK_SWITCH);
 
@@ -344,7 +339,7 @@
 }
 
 void
-Viewer::mainLoop()
+Viewer::mainInit()
 {
     HTaskPtr task_next = initLoop();
 
--- a/TaskManager/Test/test_render/viewer.h	Thu Sep 24 17:45:35 2009 +0900
+++ b/TaskManager/Test/test_render/viewer.h	Thu Sep 24 20:43:14 2009 +0900
@@ -53,8 +53,8 @@
     void get_send_controll();
 private:
     HTaskPtr initLoop();
-    void mainLoop();
-    void speLoop();
+    void mainInit();
+    void speInit();
 
 };