diff TaskManager/Test/test_render/viewer.cc @ 449:0bed2a9889f5 draft

get_segment fixed. and test_nogl rollback to 426. move!
author kazz@henri.cr.ie.u-ryukyu.ac.jp
date Fri, 25 Sep 2009 18:06:01 +0900
parents efe8584a7b5a
children baefa979bb31
line wrap: on
line diff
--- a/TaskManager/Test/test_render/viewer.cc	Fri Sep 25 16:49:49 2009 +0900
+++ b/TaskManager/Test/test_render/viewer.cc	Fri Sep 25 18:06:01 2009 +0900
@@ -10,8 +10,6 @@
 #include "TaskManager.h"
 #include <wchar.h>
 #include "Pad.h"
-#include "Application.h"
-#include "Application/Chain.h"
 
 static void post2runLoop(void *viewer);
 static void post2runDraw(void *viewer);
@@ -20,8 +18,6 @@
 //static void post2exchange_sgroot(void *viewer);
 static void post2speRunLoop(void *viewer);
 static void post2runMoveDrawLoop(void *viewer);
-static void post2runMove(void *viewer_);
-
 
 /* measure for FPS (Frame Per Second) */
 int start_time;
@@ -103,6 +99,7 @@
 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);
@@ -165,10 +162,8 @@
 	vacuum_init2(manager, this->width, this->height);
         break;
     case 16:
-        //chain_init(manager, this->width, this-> height);
-	application = new Chain();
-	application->init(manager, this->width, this->height);
-	speInit();
+        chain_init(manager, this->width, this-> height);
+	speLoop();
 	return;
         break;
     case 17:
@@ -179,7 +174,7 @@
         break;
     }   
 
-    mainInit();
+    mainLoop();
 }
 
 
@@ -236,7 +231,7 @@
 
 /* Loop って言っても1回しか実行されない */
 void
-Viewer::speInit()
+Viewer::speLoop()
 {
     HTaskPtr task_next = initLoop();
     // key の情報を格納する領域を確保する (global_alloc(KEY_STATUS))
@@ -247,6 +242,13 @@
     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);
@@ -298,14 +300,11 @@
     }
 }
 
-
 static void
 post2runMoveDrawLoop(void *viewer_)
 {
-
     Viewer *viewer = (Viewer*)viewer_;
-    Application *application = viewer->application;
-
+    
     // 同じ PPE 上なので sgroot(ポインタ) を add_param で送る。 
     //HTaskPtr send_key_task = viewer->manager->create_task(SEND_KEY);
     //send_key_task->add_param((int)sgroot);
@@ -316,13 +315,10 @@
     update_key->spawn();
 
     /* TASK_MOVE は外から引数で取ってくるべき */
-    //HTaskPtr move_task = viewer->manager->create_task(viewer->move_taskid);
-    HTaskPtr move_task = viewer->manager->create_task(application->move_task_id());
-    move_task->add_inData(application->propertyPtr, application->property_size);
-    move_task->add_outData(application->propertyPtr, application->property_size);
+    //HTaskPtr move_task = viewer->manager->create_task(viewer->move_taskid);    
+    HTaskPtr move_task = viewer->manager->create_task(TASK_MOVE);
+    //move_task->add_param(sgroot);
 
-    HTaskPtr sg_update_task = viewer->manager->create_task(TASK_SG_UPDATE);
-    sg_update_task->spawn();
     HTaskPtr draw_task = viewer->manager->create_task(TASK_DRAW);
 
     HTaskPtr switch_task = viewer->manager->create_task(TASK_SWITCH);
@@ -333,7 +329,6 @@
     draw_task->spawn();
 
     switch_task->set_post(post2runMoveDrawLoop, (void*)viewer);
-    switch_task->set_post(post2speRunLoop, (void*)viewer);
     switch_task->spawn();
     
 }
@@ -347,12 +342,11 @@
 }
 
 void
-Viewer::mainInit()
+Viewer::mainLoop()
 {
     HTaskPtr task_next = initLoop();
 
-    task_next->set_post(post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
-    task_next->set_post(post2runMove, (void *)this); // set_post(function(this->run_loop()), NULL)
+    task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
     task_next->spawn();
 }