bool Application::OnInit() {
	std::string textException = "OnInit() => ";
	
	try {
		SettingsCreator::ConfigureSettingsFile();

		InitializeSDLSystem();
		InitializeVideoSystem();
		InitializeTTFSystem();
		InitializeAudioSystem();
		InitializeResources();

		StateManager::SetActiveState(STATE_MENU);

		return true;
	} catch (const SDLException& sdlException) {
		textException.append(sdlException.WhatHappens());

		throw SDLException(textException);
	} catch (const TTFException& ttfException) {
		textException.append(ttfException.WhatHappens());

		throw TTFException(textException);
	} catch (const MixerException& mixerException) {
		textException.append(mixerException.WhatHappens());

		throw MixerException(textException);
	} catch (const GenericException& exception) {
		textException.append(exception.WhatHappens());

		throw GenericException(textException);
	}

	return false;
}
GUIManager::GUIManager()
    : mRenderer(0), itemSelected(NULL)
{
	InitializeResources();
	SetUpResources();
	RegisteredFrameListener::Startup();
}
void MenusScene::Initialize()
{
	InitializeResources(resourceGroupName);

	player1Nav = MenuNavigator(this);
	player1Nav.AllowMenuControls = true;

	player2Nav = MenuNavigator(this);

	Player1Data.MainElement = ElementEnum::Earth;
	Player2Data.MainElement = ElementEnum::Earth;

	InputNotifier::GetInstance()->AddObserver(&player1Nav);
	InputNotifier::GetInstance()->AddObserver(&player2Nav);

	guiManager->AddScheme("MainMenu.scheme");
	guiManager->LoadLayout("MainMenuLayout.layout", nullptr);
	guiManager->LoadLayout("GameSetupMenu.layout", nullptr);
	guiManager->LoadLayout("TutorialLayout.layout", nullptr);

	//guiManager->LoadLayout("CharacterSetupMenu.layout", nullptr);
	
	if(progressBar.GetWindow() == NULL)
	{
		CEGUI::Window* progressWindow = CEGUI::WindowManager::getSingleton().createWindow("Generic/Image", "CursorProgress");
		progressWindow->setSize( CEGUI::USize(CEGUI::UDim( 0.1f, 0 ), CEGUI::UDim( 0.1f, 0 ) ) );
		progressWindow->setPosition( CEGUI::UVector2(CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.5f, 0 ) ) );
		progressWindow->setAlwaysOnTop(true);
		progressWindow->setMousePassThroughEnabled(true);

		guiManager->GetRootWindow()->addChild(progressWindow);
		progressBar.SetWindow(progressWindow);
		progressWindow->setVisible(true);
	}

	handlers[Screens::MainMenu] = new MainMenuHandler(this);
	//handlers[Screens::CharacterSetup] = new CharacterMenuHandler(this);
	handlers[Screens::GameSetup] = new GameSetupMenuHandler(this);
	handlers[Screens::Tutorial] = new TutorialMenuHandler(this);

	for (unsigned int i = 0; i < Screens::Count; i++)
	{
		handlers[i]->Hide();
	}

	//currentScreen = GameSetup;
	handlers[currentScreen]->Show();

	InputManager* inputManager = InputManager::GetInstance();

	KinectSpeechReader* speechReader = inputManager->GetSpeechReader();
	if(speechReader)
	{
		inputManager->RegisterAudioListener(&player1Nav);
		//Load the grammar for this scene
		if(!speechReader->LoadGrammarFile("MenusSpeech.grxml"))
			printf("Grammer Load Fail\n");
		//Set the confidence threshold
		speechReader->SetConfidenceThreshold(0.6f);
	}

	ogreSceneManager->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 1.0f));

	CreateCameraAndViewport(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 0.0f));

}
Exemple #4
-1
int main(int argc, char **argv) {

	// GLUT initialization.
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_MULTISAMPLE);
	glEnable(GL_MULTISAMPLE);
	glutInitWindowSize(width, height);
	glutCreateWindow("Codebase 1, 3.3+ Edition");


	glewInit();
	if (glewIsSupported("GL_VERSION_2_0"))
		printf("Ready for OpenGL 2.0\n");
	else {
		printf("OpenGL 2.0 not supported\n");
		exit(1);
	}
	printf("%s\n", glGetString(GL_VERSION));
	Controls = new controls(height, width);
	//Shaders

	glutDisplayFunc(Display);
	InitializeResources();
	Controls->setCntrlsViewMatrix(ViewMatrix);
	Controls->setCntrlsProjectionMatrix(ProjectionMatrix);
	Controls->setVector(indexed_vertices);
	Controls->btInitDefaultMotionState();
	glutReshapeFunc(ReshapeWindow);
	glutMotionFunc(Controls->mouseMoveWrapper);
	glutIdleFunc(Idle);
	glutKeyboardFunc(Controls->keyboardWrapper);
	glutMouseFunc(Controls->mouseButtonPressWrapper);
	glutMouseWheelFunc(Controls->Mouse_wheelWrapper);


	
	// Enter GLUT loop.
	glutMainLoop();

	return 0;

}