本文整理汇总了C++中Application::CleanUp方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::CleanUp方法的具体用法?C++ Application::CleanUp怎么用?C++ Application::CleanUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::CleanUp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
ReportMemoryLeaks();
int main_return = EXIT_FAILURE;
main_states state = MAIN_CREATION;
Application* App = nullptr;
while (state != MAIN_EXIT)
{
switch (state)
{
case MAIN_CREATION:
{
LOG("\nApplication Creation --------------");
App = new Application();
state = MAIN_START;
} break;
case MAIN_START:
{
LOG("\nApplication Init -------------------");
if(App->Init() == false)
{
LOG("\nApplication Init exits with error -----");
state = MAIN_EXIT;
}
else
state = MAIN_UPDATE;
} break;
case MAIN_UPDATE:
{
int update_return = App->Update();
if (update_return == UPDATE_ERROR)
{
LOG("\nApplication Update exits with error -----");
state = MAIN_EXIT;
}
if (update_return == UPDATE_STOP)
state = MAIN_FINISH;
} break;
case MAIN_FINISH:
{
LOG("\nApplication Finishing --------------");
if (App->CleanUp() == false)
LOG("\nApplication Finish executed with errors -----");
else
LOG("\nApplication Finish Successfull -----");
state = MAIN_EXIT;
}
// TODO 1: Implement case MAIN_FINISH
}
}
LOG("\nBye :)\n");
return main_return;
}
示例2: main
int main(int argc, char ** argv)
{
LOG("Starting game '%s'...", TITLE);
int main_return = EXIT_FAILURE;
main_states state = MAIN_CREATION;
Application* App = NULL;
while (state != MAIN_EXIT)
{
switch (state)
{
case MAIN_CREATION:
LOG("-------------- Application Creation --------------");
App = new Application();
state = MAIN_START;
break;
case MAIN_START:
LOG("-------------- Application Init --------------");
if (App->Init() == false)
{
LOG("Application Init exits with ERROR");
state = MAIN_EXIT;
}
else
{
state = MAIN_UPDATE;
LOG("-------------- Application Update --------------");
}
break;
case MAIN_UPDATE:
{
int update_return = App->Update();
if (update_return == UPDATE_ERROR)
{
LOG("Application Update exits with ERROR");
state = MAIN_EXIT;
}
if (update_return == UPDATE_STOP)
state = MAIN_FINISH;
}
break;
case MAIN_FINISH:
LOG("-------------- Application CleanUp --------------");
if (App->CleanUp() == false)
{
LOG("Application CleanUp exits with ERROR");
}
else
main_return = EXIT_SUCCESS;
state = MAIN_EXIT;
break;
}
}
delete App;
LOG("Exiting game '%s'...\n", TITLE);
return main_return;
}
示例3: 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;
}