Ejemplo n.º 1
0
void AppResize( JNIEnv*  env, jobject  thiz, jint w, jint h )
{
	std::string		apkpath;
	FileSystemZip*	pFileSystem = NULL;

	g_winVideoScreenX = w;
	g_winVideoScreenY = h;
		
	if (!BaseApp::GetBaseApp()->IsInitted())
	{
		srand( (unsigned)time(NULL) );

#ifdef _DEBUG
	LogMsg("Setup screen to %d %d", w, h);
#endif
		SetupScreenInfo(GetPrimaryGLX(), GetPrimaryGLY(), ORIENTATION_PORTRAIT);
				
		apkpath 	= GetAPKFile();
		
#ifdef _DEBUG
		LogMsg("Initializing BaseApp.  APK filename is %s", apkpath.c_str());
#endif				
		pFileSystem = new FileSystemZip();

		if( pFileSystem->Init_unz(apkpath) )
		{
			LogMsg("APK based Filesystem mounted.");
		}
		else
		{
			LogMsg("Error finding APK file to load resources (%s", apkpath.c_str());
		}

		pFileSystem->SetRootDirectory("assets");

		FileManager::GetFileManager()->MountFileSystem(pFileSystem);
				
		if (!BaseApp::GetBaseApp()->Init())
		{
			LogMsg("Unable to initalize BaseApp");
		}

		pthread_mutex_init(&s_mouselock, NULL);

		//let's also create our save directory on the sd card if needed, so we don't get errors when just assuming we can save
		//settings later in the app.
		CreateDirectoryRecursively("", GetAppCachePath());
	}

	BaseApp::GetBaseApp()->OnScreenSizeChange();
}
Ejemplo n.º 2
0
    void Screen::CreateSFMLWindow()
    {
        SetupScreenInfo(screen);

        unsigned long style = sf::Style::Close;
        if(screen.fullscreen)
            style |= sf::Style::Fullscreen;
        if(screen.resizable)
            style |= sf::Style::Resize;
        sf::VideoMode videoMode(screen.width, screen.height);

        window.Create(videoMode, windowTitle, style);

        SORE_Kernel::Event e;
        e.type = SORE_Kernel::RESIZE;
        e.resize.w = screen.width;
        e.resize.h = screen.height;
        //input.InjectEvent(e);
    }
Ejemplo n.º 3
0
    bool Screen::OnResize(const Event& event)
    {
        if(event.type == RESIZE)
        {
            screen.useNativeResolution = false;
            screen.width  = event.resize.w;
            screen.height = event.resize.h;
            SetupScreenInfo(screen);

            // make sure viewport is correct
            glViewport(0, 0, screen.width, screen.height);

            return true;
        }
        else
        {
            return false;
        }
    }