Ejemplo n.º 1
0
        //--------------------------------------------------------------------------------
        ChilliSource::SystemInfoCUPtr SystemInfoFactory::CreateSystemInfo() noexcept
        {
            // Create DeviceInfo.
            ChilliSource::DeviceInfo deviceInfo(k_deviceModel, k_deviceModelType, k_deviceManufacturer, k_deviceUdid, GetLocale(), ParseLanguageFromLocale(GetLocale()), GetOSVersion(), GetNumberOfCPUCores());

            // Create ScreenInfo.
            ChilliSource::ScreenInfo screenInfo(GetScreenResolution(), 1.0f, 1.0f, GetSupportedFullscreenResolutions());

			//Create RenderInfo
			ChilliSource::RenderInfo renderInfo = OpenGL::RenderInfoFactory::CreateRenderInfo();

            // Create SystemInfo.
            ChilliSource::SystemInfoUPtr systemInfo(new ChilliSource::SystemInfo(deviceInfo, screenInfo, renderInfo, ""));

            return std::move(systemInfo);
        }
Ejemplo n.º 2
0
TCGbool TCGClient::Init(TCGint argc, TCGchar **argv, const TCGchar* fname)
{
#ifdef Android
    if (!ParseArgFile(PLAY_CONF_FILE, g_args))
    {
        return ;
    }
#elif defined(WIN32) || defined(__APPLE__)
    if (!ParseArgv(argc, argv, g_args))
    {
        return TCG_FALSE;
    }
#endif

    GetScreenResolution();
    GetScreenPosition();
    ConnectServer();

    m_stream.SetCompressFlag(g_args.compressedFile);

    return TCG_TRUE;
}
Ejemplo n.º 3
0
	void Application::CheckCursorInfiniteMode()
	{
		int threshold = 10;
		POINT p, lp;
		GetCursorPos(&p);
		lp = p;

		Vec2I resolution = GetScreenResolution();

		if (p.x > resolution.x - threshold)
			p.x = threshold;
		else if (p.x < threshold)
			p.x = resolution.x - threshold;

		if (p.y > resolution.y - threshold)
			p.y = threshold;
		else if (p.y < threshold)
			p.y = resolution.y - threshold;

		SetCursorPos(p.x, p.y);

		if (p.x != lp.x || p.y != lp.y)
			mCursorCorrectionDelta = Vec2F((float)(lp.x - p.x), (float)(lp.y - p.y));
	}
Ejemplo n.º 4
0
int Windows::CreateNewWindow( float* a_fSize, float* a_fPos, int a_iWindowID, 
	const char* a_ccWindowTitle, int a_iShare )
{
	a_fSize;

	Window* NewWindow = new Window;

	NewWindow->windowID = a_iWindowID;
	NewWindow->glewContext = new GLEWContext();

	NewWindow->pWindowSize = GetScreenResolution();

	NewWindow->pCamera.Camera( Vec4( 0, 0, 0, 1 ), Vec4( 0, 0, 1, 0 ), Vec4( 0, 1, 0, 0 ) );
	NewWindow->pProjection.Ortho( 0.f, NewWindow->pWindowSize[0], 0.f, NewWindow->pWindowSize[1], 0.f, 100.f );
	NewWindow->pView = NewWindow->pCamera.LookAt();

	if( a_iShare == NULL )
	{
		NewWindow->windowHandle = glfwCreateWindow( (int)NewWindow->pWindowSize[0], (int)NewWindow->pWindowSize[1], "Simple example", NULL, NULL );
	}
	else if( a_iShare != NULL )
	{
		std::vector<Window*>::iterator pIter = WindowList.begin();
		for( ; pIter != WindowList.end(); ++pIter)
		{
			Window* pWindow = (*pIter);	
			if( pWindow->windowID == a_iShare )
			{				
				NewWindow->windowHandle = glfwCreateWindow( (int)NewWindow->pWindowSize[0], (int)NewWindow->pWindowSize[1], "Simple example", glfwGetPrimaryMonitor(), pWindow->windowHandle );
				break;
			}
		}
	}

	glfwSetWindowTitle( NewWindow->windowHandle, a_ccWindowTitle );

	glfwSetWindowPos( NewWindow->windowHandle, (int)a_fPos[0], (int)a_fPos[1] );

	glfwSetWindowSizeCallback( NewWindow->windowHandle, WindowResize );

	// Set this window to current so that GLEW can
	// be initialised
	glfwMakeContextCurrent( NewWindow->windowHandle );
	CurrentWindow = NewWindow;
	
	// Init GLEW
	glewExperimental = 1;
	if( glewInit() != 0 )
	{		
		std::cout << "Initialise GLEW: " << glGetError() << std::endl;
	}
	
	// Set up screen quadrants
	// Top Left Quad
	NewWindow->m_pScreenQuadrants[0] = ScreenQuadrant( 1, Vec2( 0.f, 0.f ), 
														Vec2 ( NewWindow->pWindowSize[0] / 2, NewWindow->pWindowSize[1] / 2 ) ); 
	// Top Right Quad
	NewWindow->m_pScreenQuadrants[1] = ScreenQuadrant( 2, Vec2 ( 0.f, NewWindow->pWindowSize[1] / 2 ), 
														Vec2 ( NewWindow->pWindowSize[0] / 2, NewWindow->pWindowSize[1] / 2 ) );
	// Bottom Left Quad
	NewWindow->m_pScreenQuadrants[2] = ScreenQuadrant( 3, Vec2 ( NewWindow->pWindowSize[0] / 2, 0.f ), 
														Vec2 ( NewWindow->pWindowSize[0] / 2, NewWindow->pWindowSize[1] / 2 ) ); 
	// Bottom Right Quad
	NewWindow->m_pScreenQuadrants[3] = ScreenQuadrant( 4, Vec2 ( NewWindow->pWindowSize[0] / 2, NewWindow->pWindowSize[1] / 2 ), 
														Vec2 ( NewWindow->pWindowSize[0] / 2, NewWindow->pWindowSize[1] / 2 ) ); 

	glViewport( 0, 0, (int)NewWindow->pWindowSize[0], (int)NewWindow->pWindowSize[1] );

	WindowList.push_back( NewWindow );

	return a_iWindowID;
}