int main (int argc, char *argv[]) { try { timer mainStartTime = gettimer(); global_window_title = window_title_string (argc, (const char**)argv); argoptions opt = ParseCommandLine(argc, (const char**)argv); if ( CreateScene(opt) != 0 ) return -1; tachyon_video tachyon; tachyon.threaded = true; tachyon.init_console(); tachyon.title = global_window_title; // always using window even if(!global_usegraphics) global_usegraphics = tachyon.init_window(global_xwinsize, global_ywinsize); if(!tachyon.running) return -1; video = &tachyon; tachyon.main_loop(); utility::report_elapsed_time(timertime(mainStartTime, gettimer())); return 0; } catch ( std::exception& e ) { std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n"; return 1; } }
void tachyon_video::on_process() { char buf[8192]; flt runtime; scenedef *scene = (scenedef *) global_scene; updating_mode = scene->displaymode == RT_DISPLAY_ENABLED; recycling = false; pausing = false; do { updating = updating_mode; timer start_timer = gettimer(); rt_renderscene(global_scene); timer end_timer = gettimer(); runtime = timertime(start_timer, end_timer); sprintf(buf, "%s: %.3f seconds", global_window_title, runtime); rt_ui_message(MSG_0, buf); title = buf; show_title(); // show time spent for rendering if(!updating) { updating = true; drawing_memory dm = get_drawing_memory(); drawing_area drawing(0, 0, dm.sizex, dm.sizey);// invalidate whole screen } rt_finalize(); title = global_window_title; show_title(); // reset title to default } while(recycling && running); }
void rt_finalize(void) { timerstart(); if(global_usegraphics) do { rt_sleep(10); timerstop(); } while(timertime() < 10 && video->next_frame()); #ifdef _WINDOWS else rt_sleep(10000); #endif }
void rt_finalize(void) { timer t0, t1; t0 = gettimer(); if(global_usegraphics) do { rt_sleep(10); t1 = gettimer(); } while(timertime(t0, t1) < 10 && video->next_frame()); #ifdef _WINDOWS else rt_sleep(10000); #endif }
void on_process() { char buf[128]; flt runtime; timerstart(); rt_renderscene(global_scene); timerstop(); runtime=timertime(); sprintf(buf, "\nCPU Time: %.3f seconds.", runtime); rt_ui_message(MSG_0, buf); buf[0] = ' '; strcat(global_window_title, buf); title = global_window_title; updating = true; show_title(); rt_finalize(); }