예제 #1
0
bool Bundle::extractInfo()
{
    QString plistLocation = QString("%1Info.plist").arg(path());
    QString configXml = QString("%1config.xml").arg(path());
    if (QFile::exists(plistLocation)) {
        //qDebug() << "doing plist";
        return parsePlist(plistLocation);
    } else if (QFile::exists(configXml)) {
        return parseConfigXml(configXml);
    }

    return false;
}
예제 #2
0
파일: main.cpp 프로젝트: CZdravko/Horde
int main(int argc, char** argv)
{
	parseConfigXml();

	if (sceneFile.empty() && argc >= 2)
	{
		sceneFile = argv[1];
	}

	if (sceneFile.empty())
	{
		std::cerr << "No Scenefile given. Please configure config.xml or pass an argument!" << std::endl;
		glfwOpenWindow( 640, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW );
		glfwSetWindowTitle( "No Scenefile given. Please configure config.xml or pass an argument!" );
		double startTime = glfwGetTime();
		while( glfwGetTime() - startTime < 5.0 ) {}
		glfwTerminate();
		return -1;
	}

	// Initialize GLFW
	glfwInit();
	if( !setupWindow( width, height, fullScreen ) )
		return -1;

	GLFWvidmode desktopMode;
	glfwGetDesktopMode( &desktopMode );

	// Initalize application and engine
	app = new DemoApp();
	if ( !app->init(sceneFile.c_str()) )
	{
		std::cout << "Unable to initalize engine" << std::endl;
		std::cout << "Make sure you have an OpenGL 2.0 compatible graphics card";

		// Fake message box
		glfwCloseWindow();
		glfwOpenWindow( 800, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW );
		glfwSetWindowTitle( "Unable to initalize engine - Make sure you have an OpenGL 2.0 compatible "
			"graphics card and have specified a valid GameEngine scene" );
		double startTime = glfwGetTime();
		while( glfwGetTime() - startTime < 5.0 ) {}  // Sleep

		glfwTerminate();
		return -1;
	}
	app->resize( width, height );

	//glfwDisable( GLFW_MOUSE_CURSOR );

	int frames = 0;
	float fps = 30.0f;
	t0 = glfwGetTime();
	running = true;

	// Game loop
	while( running )
	{
		// Calc FPS
		++frames;
		if( frames >= 3 )
		{
			double t = glfwGetTime();
			fps = frames / (float)(t - t0);
			frames = 0;
			t0 = t;
		}

		// Render
		app->render();
		glfwSwapBuffers();
	}

	glfwEnable( GLFW_MOUSE_CURSOR );

	// Quit
	app->release();
	delete app;
	glfwTerminate();

	return 0;
}