Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
File: main.cpp Progetto: KrysG/Unuk
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;
}