本文整理汇总了C++中Application::ChangeTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::ChangeTo方法的具体用法?C++ Application::ChangeTo怎么用?C++ Application::ChangeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::ChangeTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int main_return = EXIT_SUCCESS;
main_states state = MAIN_START;
update_status update_state;
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS) == -1)
{
LOG("Application exit with error: %s", SDL_GetError());
return EXIT_FAILURE;
}
Application app;
while (state != MAIN_EXIT)
{
switch (state)
{
case MAIN_UPDATE: //------------------UPDATE-----------------
//LOG("UPDATING:");
switch (update_state)
{
case UPDATE_CONTINUE:
update_state = app.Update();
break;
case UPDATE_ERROR:
state = MAIN_ERROR;
break;
case UPDATE_STOP:
state = MAIN_FINISH;
break;
default:
if (!app.ChangeTo(update_state)){ state = MAIN_ERROR; }
else { update_state = UPDATE_CONTINUE; }
break;
}
break;
case MAIN_ERROR: //------------------ERROR-----------------
LOG("Application exit with error: %s", SDL_GetError());
main_return = EXIT_FAILURE;
state = MAIN_EXIT;
break;
case MAIN_START: //------------------START-----------------
LOG("Starting Application:");
if (!app.Init()){ state = MAIN_ERROR; }
else { state = MAIN_UPDATE; update_state = CHANGE_TO_TITLE; }
break;
case MAIN_FINISH: //------------------FINISH-----------------
LOG("Finishing Application:");
if (!app.CleanUp()){ state = MAIN_ERROR; }
else{ state = MAIN_EXIT; }
SDL_Quit();
break;
}
}
return main_return;
}