comparison Renderer/Engine/viewer.cc @ 1033:431936c0cc96

add application main method and task.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 26 Nov 2010 04:32:59 +0900
parents 67ff44a08090
children a0faa0cfc271
comparison
equal deleted inserted replaced
1010:44b2c4cb539d 1033:431936c0cc96
140 140
141 start_time = get_ticks(); 141 start_time = get_ticks();
142 this_time = 0; 142 this_time = 0;
143 frames = 0; 143 frames = 0;
144 144
145 this->app = app;
145 MainLoop *mainloop = app->init(this, this->width, this->height); 146 MainLoop *mainloop = app->init(this, this->width, this->height);
146 mainloop->mainLoop(); 147 mainloop->mainLoop();
147 } 148 }
148 149
149 150
290 void 291 void
291 Viewer::mainLoop() 292 Viewer::mainLoop()
292 { 293 {
293 HTaskPtr task_next = initLoop(); 294 HTaskPtr task_next = initLoop();
294 295
296 task_next = app->application_task(task_next, this);
295 task_next->set_post(&post2runLoop, (void *)this, (void*)pixels); // set_post(function(this->run_loop()), NULL) 297 task_next->set_post(&post2runLoop, (void *)this, (void*)pixels); // set_post(function(this->run_loop()), NULL)
296 task_next->spawn(); 298 task_next->spawn();
297 } 299 }
298 300
299 void 301 void
310 } 312 }
311 313
312 dev->clean_pixels(); 314 dev->clean_pixels();
313 315
314 pixels = dev->flip_screen(pixels); 316 pixels = dev->flip_screen(pixels);
315
316 sgroot->updateControllerState(); 317 sgroot->updateControllerState();
318 app->app_main(this);
317 319
318 //TaskArray を使うか使わないか 320 //TaskArray を使うか使わないか
319 if (sgroot->gtask_array != NULL) { 321 if (sgroot->gtask_array != NULL) {
320 sgroot->create_task_array(); 322 sgroot->create_task_array();
321 sgroot->allExecute(width, height); 323 sgroot->allExecute(width, height);