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 BaseApp::OnFullscreenToggleRequest()
{
#ifdef _WINDOWS_
	
	static int savex =0;
	static int savey =0;

	if (g_bIsFullScreen)
	{
		GetBaseApp()->SetVideoMode(savex, savey, false);

	} else
	{
		savex = GetPrimaryGLX();
		savey = GetPrimaryGLY();

		GetBaseApp()->SetVideoMode(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), true);

	}
#endif
}
Ejemplo n.º 3
0
#ifndef _CONSOLE

    int stagewidth, stageheight;

	inline_as3(
		"import com.adobe.flascc.Console;\n"
		"import com.adobe.flascc.CModule;\n"
		"import flash.display.Bitmap;\n"
		"import flash.display.BitmapData;\n"
		"%0 = Console.screenWidth;\n"
		"%1 = Console.screenHeight;\n"
		: "=r"(g_nativeScreenWidth), "=r"(g_nativeScreenHeight) :
	);
  
	LogMsg("Screensize: %d, %d", GetPrimaryGLX(), GetPrimaryGLY());
	
	
			GLFlashAdaptor_Initialize();
			SetupScreenInfo(GetPrimaryGLX(), GetPrimaryGLY(), ORIENTATION_PORTRAIT);
 #endif

	#ifndef _CONSOLE
		if (!GetBaseApp()->Init())
		{
			LogError("Unable to init app");
			return -1;
		}
		#else
		if (!GetApp()->Init())
		{
void RenderScissorComponent::FilterOnRender(VariantList *pVList)
{

	CHECK_GL_ERROR()
	g_globalBatcher.Flush();

	GLboolean b = false;
	
	//Note: This fails when using the webOS emulation libs on Windows.. but works on the real device
	glGetBooleanv(GL_SCISSOR_TEST, &b);
	
#if defined(WIN32) && defined(RT_WEBOS) && defined(_DEBUG)
	//clear the error out so it doesn't flood our log
	glGetError();
#endif
	m_bOldScissorEnabled = b != 0;
	CHECK_GL_ERROR()
	if (m_bOldScissorEnabled)
	{
		//warning: Untested code...
		GLint nums[4];
		glGetIntegerv(GL_SCISSOR_BOX, &nums[0]);
		m_oldScissorPos = CL_Vec2f((float)nums[0],(float) nums[1]);
		m_oldScissorSize = CL_Vec2f((float)nums[2],(float) nums[3]);
		CHECK_GL_ERROR()
	}

	CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
	//vFinalPos -= GetAlignmentOffset(*m_pSize2d, eAlignment(*m_pAlignment));	

	CL_Rectf clipRect(vFinalPos.x, vFinalPos.y, vFinalPos.x+m_pSize2d->x, vFinalPos.y+m_pSize2d->y);
		
	//well, turns out we need to always do this on iOS, as this accounts for the screen being rotated as well, not just
	//the scaling issue

//	if (NeedToUseFakeScreenSize())
	{
		//Oh shit-sticks. We're stretching our content and using a fake screensize.  We'll need to convert
		//our glScissor rect to match the real gl surface size.
	
		float angle = OrientationToDegrees(GetOrientation());
		while (angle < 0)
		{
			angle+= 360;
		}
		rtRectf r = rtRectf(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
		r = ConvertFakeScreenRectToReal(r);
		clipRect = CL_Rectf(r.left, r.top, r.right, r.bottom);

		float primaryX = (float)GetPrimaryGLX();
		float primaryY = (float)GetPrimaryGLY();
		
		if (InLandscapeGUIMode())
		{
			swap(primaryX, primaryY);
		}
		
		clipRect = RotateRect(clipRect, angle, CL_Vec2f(primaryX, primaryY));
	}

	//remember, glScissors x/y is the LOWER LEFT of the rect, not upper left. (and lower left is 0,0)
	glScissor((GLint)clipRect.left, (GLint)GetPrimaryGLY()-((GLint)clipRect.top+(GLint)clipRect.get_height()), (GLint)clipRect.get_width(),(GLint) clipRect.get_height());
	glEnable(GL_SCISSOR_TEST);

}