本文整理汇总了C++中Main::initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Main::initialize方法的具体用法?C++ Main::initialize怎么用?C++ Main::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main::initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
cout<<"Fluid simulation"<<endl;
// Defaults
logging = true;
sequential = false;
render = true;
deviceType = CL_DEVICE_TYPE_ALL;
int targetFPS = 20;
// Parse arguments
for(int i = 0; i < argc; i++)
{
if(strcmp(argv[i], "-nolog") == 0)
logging = false;
else if(strcmp(argv[i], "-cpu") == 0)
deviceType = CL_DEVICE_TYPE_CPU;
else if(strcmp(argv[i], "-gpu") == 0)
deviceType = CL_DEVICE_TYPE_GPU;
else if(strcmp(argv[i], "-sequential") == 0)
sequential = true;
else if(strcmp(argv[i], "-fps") == 0)
targetFPS = atoi(argv[i+1]);
else if(strcmp(argv[i], "-norender") == 0)
render = false;
}
//Start simulating!
mainProgram.initialize(targetFPS);
mainProgram.run();
}
示例2: main
s32 main(s32 argc, char* argv[])
{
std::string log_name = get_option(argv, argc, "-l");
std::string rom = "../bin/Ca Da.gb"; // If a ROM isn't specified on command line, then execute the ROM specified here
if (log_name == "-")
{
log_name = "../bin/GBS.log"; // If a log name isn't specified, use the default
}
if (argc >= 2)
{
rom = argv[1];
}
if (!init_logging(log_name))
{
log(ERROR, "Initialization of logging failed.");
return exit(true);
}
Game game;
if (!game.load(rom))
{
log(ERROR, "Failed to load the ROM.");
return exit(true);
}
Main* core = nullptr;
switch (game.game_type)
{
case GAMEBOY_COLOR:
case GAMEBOY: core = new GBMain(game); break;
default: log(ERROR, "Unsupported game type: %d", game.game_type); return exit(true);
}
if (!core->initialize())
{
log(ERROR, "Failed to initialize emulation core.");
return exit(true);
}
core->run();
}
示例3: main
int32 main(int32 argc, const ansichar* argv[]) {
struct Guard {
Guard(Main* app) : ref(app){}
~Guard() {
if (ref) ref->shutdown();
}
Main* ref;
};
Main* app = Main::Startup(argc, argv);
Guard _(app); //shutdown on main leave
if (!app->initialize()) {
LOG_ERROR(General, "Initialization failed.");
return 1;
}
return app->execute();
}