changeset 398:e621024b6ef1

separate existing source
author game@henri.cr.ie.u-ryukyu.ac.jp
date Sun, 20 Sep 2009 19:21:04 +0900
parents a4f690f44842
children 4bea73c83c35
files TaskManager/Test/test_render/viewer.cpp
diffstat 1 files changed, 33 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/viewer.cpp	Sun Sep 20 18:55:26 2009 +0900
+++ b/TaskManager/Test/test_render/viewer.cpp	Sun Sep 20 19:21:04 2009 +0900
@@ -11,6 +11,9 @@
 #include <wchar.h>
 #include "Pad.h"
 
+private void Viewer::initLoop();
+private void Viewer::mainLoop();
+private void Viewer::speLoop();
 static void post2runLoop(void *viewer);
 static void post2runDraw(void *viewer);
 static void post2runMove(void *viewer);
@@ -105,8 +108,6 @@
 void
 Viewer::run_init(TaskManager *manager, const char *xml, int sg_number)
 {
-    HTaskPtr task_next;
-    HTaskPtr task_tex;
     this->manager = manager;
 
     start_time = get_ticks();
@@ -162,11 +163,23 @@
         break;
     case 16:
         chain_init(manager, this->width, this-> height);
+	speLoop();
+	return 1;
         break;
     default:
         node_init(manager);
         break;
-    }
+    }   
+
+    mainLoop();
+}
+
+
+static void
+Viewer::initLoop()
+{
+    HTaskPtr task_next;
+    HTaskPtr task_tex;
 
     sgpack = (SceneGraphPack*)manager->allocate(sizeof(SceneGraphPack));
     sgpack->init();
@@ -221,6 +234,22 @@
         task_next->wait_for(task_tex);
         task_tex->spawn();
     }
+}
+
+static void
+Viewer::speLoop()
+{
+    initLoop();
+
+    task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
+    task_next->spawn();
+    // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
+}
+
+static void
+Viewer::mainLoop()
+{
+    initLoop();
 
     task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
     task_next->spawn();
@@ -364,8 +393,7 @@
     for (int i = 1; i <= spackList_length; i++) {
         spackList[i-1].reinit(i*split_screen_h);
     }
-    
-    task_next = manager->create_task(TASK_DUMMY);
+        
     run_move(task_next);
     //sgroot->updateControllerState();
     //sgroot->allExecute(width, height);