Exemplo n.º 1
0
bool Application::InitConsoleOnly()
{
	InitContextBasics();
	InitFileSystem();
	LoadConfig();

	if (!GetContext().IsInitializedNoGL())
		throw "Failed to initialize app context.";

	return true;
}
Exemplo n.º 2
0
bool Application::InitSimple(const std::string  &title)
{
	InitContextBasics();
	InitFileSystem();
	LoadConfig();

	if (!InitWindowAndOpenGL(title))
	{
		GetContext().GetLogger()->log(LOG_ERROR, "Failed to initialize ApplicationWindow.");
	}

	if (!GetContext().IsInitialized())
		throw "Failed to initialize app context.";

	return true;
}
Exemplo n.º 3
0
bool VismaRunnerApplication::Init()
{
	instance = this;
	//if(!InitSimple("Voxel octree application"))
	//return false;

	glm::vec2 windowSize(1280, 768);
#ifdef OCULUS_RENDER
	oculus = share(new OculusImpl());
	oculus->InitOculus();
#endif

	if (!InitContextBasics() || !InitFileSystem() || !LoadConfig())
	{
		return false;
	}

	srand(GetContext().GetTimer()->get_real_time());

	//If we want to override some settings for window.
	auto & video_group = GetContext().GetApplicationSettingsManager()->GetGroup("video");
	video_group.GetVar("window_width").Value(int(windowSize.x));
	video_group.GetVar("window_height").Value(int(windowSize.y));
	InitWindowAndOpenGL("The game app");

#ifdef OCULUS_RENDER
	oculus->InitOculusBuffers();
#endif

	GetContext().SetInputHandler(new InputHandler(GetContext().GetWindow()));
	GetContext().GetWindow()->SigKeyEvent().connect(sigc::mem_fun(this, &VismaRunnerApplication::OnKeyEvent));
	GetContext().SetGUIEnvironment(new GUIEnvironment());

	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);
	glClearColor(0.5f, 0.5f, 0.75f, 0);

	auto fontRenderer = GetContext().GetGUIEnvironment()->GetFontRenderer();
	fontRenderer->CreateFontFamily("voxeltext", 16, "res/gui/fonts/pixel.ttf");
	fontRenderer->CreateFontFamily("voxeltext24", 24, "res/gui/fonts/pixel.ttf");
	fontRenderer->CreateFontFamily("voxeltext48", 48, "res/gui/fonts/pixel.ttf");
	fontRenderer->CreateFontFamily("scoremono32", 36, "res/gui/fonts/pixelmono.otf");
	fontRenderer->CreateFontFamily("scoremono48", 48, "res/gui/fonts/pixelmono.otf");

	soundManager = share(new SoundManager());

	soundManager->AddSoundSource("res/sounds/music/level1.ogg", "BGM_Level1");
	soundManager->AddSoundSource("res/sounds/music/level2.ogg", "BGM_Level2");
	soundManager->AddSoundSource("res/sounds/music/level3.ogg", "BGM_Level3");
	soundManager->AddSoundSource("res/sounds/music/level4.ogg", "BGM_Level4");
	soundManager->AddSoundSource("res/sounds/music/level5.ogg", "BGM_Level5");
	soundManager->AddSoundSource("res/sounds/music/level6.ogg", "BGM_Level6");
	soundManager->AddSoundSource("res/sounds/music/level7.ogg", "BGM_Level7");
	soundManager->AddSoundSource("res/sounds/music/level8.ogg", "BGM_Level8");

	soundManager->AddSoundSource("res/sounds/misc/ready.ogg", "AnnouncerReady");
	soundManager->AddSoundSource("res/sounds/misc/steady.ogg", "AnnouncerSteady");
	soundManager->AddSoundSource("res/sounds/misc/go.ogg", "AnnouncerGo");

	soundManager->AddSoundSource("res/sounds/jumps/SFX_Jump_17.wav", "SFX_Jump");

	soundManager->AddSoundSource("res/sounds/explosions/SFX_Explosion_01.ogg", "SFX_Explosion1");
	soundManager->AddSoundSource("res/sounds/explosions/SFX_Explosion_02.ogg", "SFX_Explosion2");
	soundManager->AddSoundSource("res/sounds/explosions/SFX_Explosion_03.ogg", "SFX_Explosion3");

	soundManager->AddToBGMList("BGM_Level1");
	soundManager->AddToBGMList("BGM_Level2");
	soundManager->AddToBGMList("BGM_Level3");
	soundManager->AddToBGMList("BGM_Level4");
	soundManager->AddToBGMList("BGM_Level5");
	soundManager->AddToBGMList("BGM_Level6");
	soundManager->AddToBGMList("BGM_Level7");
	soundManager->AddToBGMList("BGM_Level8");

	gameStateManager = share(new GameStateManager());

	gameStateManager->RegisterState<MainGameState>("MainGameState");
	gameStateManager->RegisterState<ScoreBoardMenuState>("ScoreBoardMenuState");

	gameStateManager->SetStartingState("ScoreBoardMenuState");

	scoreInfo = share(new ScoreBoardInfo());

	return true;
}