# HG changeset patch # User game@henri.cr.ie.u-ryukyu.ac.jp # Date 1253442064 -32400 # Node ID e621024b6ef18e07ba28383a6b992e6ed8831a39 # Parent a4f690f448426618cbf92df207d4a7177df8adc2 separate existing source diff -r a4f690f44842 -r e621024b6ef1 TaskManager/Test/test_render/viewer.cpp --- 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 #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);