当前位置: 首页>>代码示例>>C++>>正文


C++ MainMenu::Run方法代码示例

本文整理汇总了C++中MainMenu::Run方法的典型用法代码示例。如果您正苦于以下问题:C++ MainMenu::Run方法的具体用法?C++ MainMenu::Run怎么用?C++ MainMenu::Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainMenu的用法示例。


在下文中一共展示了MainMenu::Run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow)
{
#if defined(DEBUG) || defined(_DEBUG)
	myInitMemoryCheck();
#endif
	//_CrtSetBreakAlloc(3795052);

	MaloW::ClearDebug();
	
	GraphicsEngineParams params;
	params.LoadFromeFile("config.cfg");
	//params.CamType = FPS;
	/*	Structure of cfg file:
	windowWidth
	windowHeight
	Maximized
	ShadowMapQuality
	FXAAQuality
	*/

	GameOptions GameParams;
	GameParams.LoadFromeFile("GameSettings.cfg");
	/*
	masterVolume
	songVolume //Funkar dock inte
	effectVolume //Funkar dock inte
	*/

	// Create the graphics engine
	GraphicsEngine* ge = new GraphicsEngine(params, hInstance, nCmdShow);
	gfxeng::eng = ge; // Set the global eng to our engine so that GetGraphicsEngine(); can work.
	ge->CreateSkyBox("Media/skymap.dds");

	//test();	// Instead of ifndef lol

	// Create the MainMenu and send the graphics engine, and then run Run();
	MainMenu* mm = new MainMenu(ge);
	mm->Run();

	delete mm;
	delete ge;
	gfxeng::eng = NULL;

	#if defined(DEBUG) || defined(_DEBUG)
		myDumpMemoryLeaks();
	#endif
	
	return 0;
}
开发者ID:Malow,项目名称:PowerBall,代码行数:49,代码来源:main.cpp

示例2: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int) 
{
	MaloW::ClearDebug();
#ifdef INCLUDE_MODEL_VIEWER
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	MaloW::Debug("(DEBUG): Client: Debug flag set to: _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF). ");
	MaloW::Debug("(DEBUG): Client: vld.h included.");
#endif

	if ( !GraphicsInit(hInstance) )
	{
		MaloW::Debug("Failed Initializing Graphics!");
		return 1;
	}
	if ( !PlayerSettingsInit() )
	{
		MaloW::Debug("Failed Initializing PlayerSettings!");
		return 1;
	}
	AudioManager* am = AudioManager::GetInstance();

	// IMPLEMENT MAIN PROGRAM HERE.
	MainMenu* menu = new MainMenu();
	menu->Init();
	menu->Run();
	SAFE_DELETE(menu);

	am->ReleaseInstance();
	am = NULL;

	// Free Graphics
	FreeGraphics();

	// Save and Free Settings
	SavePlayerSettings();
	FreePlayerSettings();
	//_CrtDumpMemoryLeaks();
	MaloW::Debug("Quit Game.");
	return 0;
}
开发者ID:Crant,项目名称:Game_Project,代码行数:40,代码来源:main.cpp

示例3: main

int main() {
  if(SDL_Init(SDL_INIT_VIDEO == -1)) {
    system("zenity --error --text=\"Could not load SDL\"");
    Debug::logger->message("Error: Could not load SDL");
    return 1;
  }
  if(TTF_Init() == -1) {
    system("zenity --error --text=\"Could not load SDL_TTF\"");
    Debug::logger->message("Error: Could not load SDL_TTF");
    return 1;
  }

  screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE);
  SDL_WM_SetCaption("fps - 00", NULL);

  srand(time(NULL));

  camera.x = 0;
  camera.y = 0;
  camera.w = SCREEN_WIDTH;
  camera.h = SCREEN_HEIGHT;

  errorTexture = LoadImage("../Data/Media/error.png");

  Text::LoadFonts();

  Game* game = NULL;
  MainMenu* menu = new MainMenu;

  bool menuRunning = true;
  while(menuRunning) {
    switch(menu->Run()) {
    case mainMenuNewGame:
      delete menu;
      game = new Game;

      switch(game->Run("save")) {
      case gameMainMenu:
        menu = new MainMenu;
        break;
      case gameQuitGame:
        menuRunning = false;
        break;
      }

      delete game;
      break;
    case mainMenuLoadGame:
      break;
    case mainMenuOptions:
      break;
    case mainMenuExitGame:
      menuRunning = false;
      delete menu;
      break;
    }
  }
  //stringstream caption;
  //caption << "Unuk - FPS: " << fps;

  //SDL_WM_SetCaption(caption.str().c_str(), NULL);

  // Clean up after ourselves.
  Text::FreeFonts();

  SDL_FreeSurface(screen);
  SDL_FreeSurface(errorTexture);

  SDL_Quit();
  TTF_Quit();

  return 0;
}
开发者ID:KrysG,项目名称:Unuk,代码行数:73,代码来源:main.cpp


注:本文中的MainMenu::Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。