本文整理汇总了C++中timerLib::get_ticks方法的典型用法代码示例。如果您正苦于以下问题:C++ timerLib::get_ticks方法的具体用法?C++ timerLib::get_ticks怎么用?C++ timerLib::get_ticks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timerLib
的用法示例。
在下文中一共展示了timerLib::get_ticks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
std::cout << "main - warning: could not create '" << SAVEPATH << "' folder" << std::endl; std::fflush(stdout);
/// @TODO - check if directory exists
} else {
std::cout << "Folder '" << SAVEPATH << "' created" << std::endl; std::fflush(stdout);
}
#endif
have_save = fio.save_exists();
#ifndef DEBUG_OUTPUT // redirect output to null
std::string cout_file = "/dev/null";
std::ofstream out(cout_file.c_str());
std::cout.rdbuf(out.rdbuf());
#else
// --- REDIRECT STDOUT TO A FILE --- //
#if defined(PSP) || defined(WII) || defined(ANDROID) || defined(DINGUX) || defined(PLAYSTATION2)
//std::string cout_file = SAVEPATH + "/stdout.txt";
std::string cout_file = FILEPATH + "/stdout.txt";
std::streambuf *coutbuf = std::cout.rdbuf();
std::ofstream out(cout_file.c_str());
std::cout.rdbuf(out.rdbuf()); //redirect std::cout to out.txt!
#endif
#endif
graphLib.preload();
#ifdef PLAYSTATION2
fio.load_config(game_config);
PS2_create_save_icons();
#endif
draw_lib.preload();
gameControl.currentStage = APEBOT;
// INIT GAME
if (GAME_FLAGS[FLAG_QUICKLOAD] == false) {
if (gameControl.showIntro() == false) {
std::cout << "ERROR SHOWING INTRO" << std::endl;
return 0;
}
} else {
gameControl.quick_load_game();
//ending end_obj;
//end_obj.start();
//return 1;
}
input.clean();
input.p1_input[BTN_START] = 0;
input.waitTime(200);
input.clean();
bool run_game = true;
while (run_game) {
#if !defined(PSP) && !defined(DINGUX)
timer.start_ticker();
#endif
#ifdef PLAYSTATION2
RotateThreadReadyQueue(_MIXER_THREAD_PRIORITY);
#endif
gameControl.showGame();
#ifdef DEBUG_SHOW_FPS
gameControl.fps_count();
#endif
draw_lib.update_screen();
if (input.p1_input[BTN_QUIT] == 1) {
//std::cout << "LEAVE #3" << std::endl;
std::fflush(stdout);
gameControl.leave_game();
}
unsigned int now_ticks = timer.get_ticks();
if (now_ticks < (1000 / FRAMES_PER_SECOND)) {
timer.delay((1000 / FRAMES_PER_SECOND) - now_ticks);
}
}
/// @TODO: sdl quit sub-systems
#ifdef PSP
sceKernelExitGame();
return 0;
#else
SDL_Quit();
#endif
return 1;
}