Exemplo n.º 1
0
string ReplaceWithLargeInFileNameAndOSSpecific(const string &fName)
{
	if (!IsLargeScreen())
	{
		return fName; //no conversation done
	}

	string final = fName;
	
	if (GetEmulatedPlatformID() == PLATFORM_ID_WINDOWS
		|| GetEmulatedPlatformID() == PLATFORM_ID_OSX)
	{
		StringReplace("iphone", "win", final);

	} else
Exemplo n.º 2
0
void BaseApp::OnEnterBackground()
{
	if (!m_bIsInBackground)
	{
		m_bIsInBackground = true;
#ifdef _DEBUG	
		LogMsg("Entering background");
#endif
	 
	#ifndef PLATFORM_ANDROID
		if (GetEmulatedPlatformID() == PLATFORM_ID_ANDROID)
		m_sig_unloadSurfaces();	
	#endif
	
		
	if (GetPlatformID() != PLATFORM_ID_ANDROID)
	{
		//android will do it elsewhere, but for other platforms we fake this message here
		m_sig_pre_enterbackground(NULL); 
	}

		m_sig_enterbackground(NULL);
	}

	GetAudioManager()->Suspend();
	//ResetTouches(); //Turns out we don't need this
    
}
Exemplo n.º 3
0
void LoopingSound::Update()
{
	if (m_bDisabled) return;

	switch (m_state)
	{
	case STATE_MOVE_START:

		if (m_waitTimer < GetTick(TIMER_SYSTEM))
		{
			m_waitTimer = 0;
			//time to kick into the move loop sound
			GetAudioManager()->Stop(m_transitionSoundHandle);
			m_transitionSoundHandle = AUDIO_HANDLE_BLANK;

			PlayMoveSound();
		}
		break;

	case STATE_MOVE_END:

		if (m_waitTimer < GetTick(TIMER_SYSTEM))
		{
			m_waitTimer = 0;
			//time to kick into the move loop sound
			GetAudioManager()->Stop(m_transitionSoundHandle);
			m_transitionSoundHandle = AUDIO_HANDLE_BLANK;

			PlayIdleSound();
		}
		break;

	case STATE_IDLE:
		if (GetEmulatedPlatformID() == PLATFORM_ID_WEBOS)
		{
			//special hack to fix crappy SDL audio issues with looping cutting out
			if (m_loopingSoundHandle > 0 && !GetAudioManager()->IsPlaying(m_loopingSoundHandle))
			{
				//restart it
				#ifdef _DEBUG
				//LogMsg("Kickstarting idle loop again");
				#endif
				PlayIdleSound();
			}
		}


		break;
	}

}
Exemplo n.º 4
0
bool App::Init()
{
	
	if (m_bInitted)	
	{
		return true;
	}
	
	if (!BaseApp::Init()) return false;
	
	if (GetEmulatedPlatformID() == PLATFORM_ID_IOS || GetEmulatedPlatformID() == PLATFORM_ID_WEBOS)
	{
		//SetLockedLandscape( true); //if we don't allow portrait mode for this game
		//SetManualRotationMode(true); //don't use manual, it may be faster (33% on a 3GS) but we want iOS's smooth rotations
	}

	LogMsg("The Save path is %s", GetSavePath().c_str());
	LogMsg("Region string is %s", GetRegionString().c_str());

#ifdef _DEBUG
	LogMsg("Built in debug mode");
#endif
#ifndef C_NO_ZLIB
	//fonts need zlib to decompress.  When porting a new platform I define C_NO_ZLIB and add zlib support later sometimes
	if (!GetFont(FONT_SMALL)->Load("interface/font_trajan.rtfont")) return false;
#endif

	GetBaseApp()->SetFPSVisible(true);
	GetBaseApp()->SetFPSLimit(30);

	/**
	* My init stuff
	*/
	g_game = new game();
	g_game->init();
	return true;
}
Exemplo n.º 5
0
void BaseApp::OnEnterForeground()
{
	GetAudioManager()->Resume();

	if (m_bIsInBackground)
	{
		m_bIsInBackground = false;
#ifdef _DEBUG
		LogMsg("Entering foreground");
#endif
	
	#ifndef PLATFORM_ANDROID
		if (GetEmulatedPlatformID() == PLATFORM_ID_ANDROID)
		{
			GetBaseApp()->m_sig_loadSurfaces(); //for anyone who cares
		}
	#endif


		m_sig_enterforeground(NULL);
	}
}
void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver, bool withStencil)
{
	const core::stringc stringVer(glGetString(GL_VERSION));
	CommonProfile = (stringVer[11]=='M');
	const f32 ogl_ver = core::fast_atof(stringVer.c_str()+13);
	Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f));
	core::stringc extensions = glGetString(GL_EXTENSIONS);
	os::Printer::log(extensions.c_str());

	// typo in the simulator (note the postfixed s)
	if (extensions.find("GL_IMG_user_clip_planes"))
			FeatureAvailable[IRR_IMG_user_clip_plane] = true;

	{
		const u32 size = extensions.size()+1;
		c8* str = new c8[size];
		strncpy(str, extensions.c_str(), extensions.size());
		str[extensions.size()]=' ';
		c8* p = str;

		for (u32 i=0; i<size; ++i)
		{
			if (str[i] == ' ')
			{
				str[i] = 0;
				if (*p)
				for (u32 j=0; j<IRR_OGLES_Feature_Count; ++j)
				{
					if (!strcmp(OGLESFeatureStrings[j], p))
					{
						FeatureAvailable[j] = true;
						break;
					}
				}

				p = p + strlen(p) + 1;
			}
		}

		delete [] str;
	}

	//make some corrects - Seth
	if (GetEmulatedPlatformID() == PLATFORM_ID_ANDROID)
	{
		FeatureAvailable[IRR_EXT_texture_filter_anisotropic] = false; //HTC, Sony xperia reports it has this, but it gives gl errrs
		//if we try to use it.. 1280, invalid enum
	}

	GLint val=0;
	glGetIntegerv(GL_MAX_TEXTURE_UNITS, &val);
	MaxSupportedTextures = core::min_(MATERIAL_MAX_TEXTURES, static_cast<u32>(val));
	MultiTextureExtension = true;
	glGetIntegerv(GL_MAX_LIGHTS, &val);
	MaxLights = static_cast<u8>(val);
#ifdef GL_EXT_texture_filter_anisotropic
	if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic])
	{
		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &val);
		MaxAnisotropy = static_cast<u8>(val);
	}
#endif
#ifdef GL_MAX_ELEMENTS_INDICES
	glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &val);
	MaxIndices=val;
#endif
	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val);
	MaxTextureSize=static_cast<u32>(val);
#ifdef GL_EXT_texture_lod_bias
	if (FeatureAvailable[IRR_EXT_texture_lod_bias])
		glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &MaxTextureLODBias);
#endif
	if ((Version>100) || FeatureAvailable[IRR_IMG_user_clip_plane])
	{
		glGetIntegerv(GL_MAX_CLIP_PLANES, &val);
		MaxUserClipPlanes = static_cast<u8>(val);
	}
	glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
	glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
	glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, DimSmoothedLine);
	glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, DimSmoothedPoint);

	MaxTextureUnits = core::min_(MaxSupportedTextures, static_cast<u8>(MATERIAL_MAX_TEXTURES));

#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
	if (FeatureAvailable[IRR_OES_draw_texture])
	{
		pGlDrawTexiOES = (PFNGLDRAWTEXIOES) eglGetProcAddress("glDrawTexiOES");
		pGlDrawTexfOES = (PFNGLDRAWTEXFOES) eglGetProcAddress("glDrawTexfOES");
		pGlDrawTexivOES = (PFNGLDRAWTEXIVOES) eglGetProcAddress("glDrawTexivOES");
		pGlDrawTexfvOES = (PFNGLDRAWTEXFVOES) eglGetProcAddress("glDrawTexfvOES");
	}
	if (FeatureAvailable[IRR_OES_blend_subtract])
	{
		pGlBlendEquationOES = (PFNGLBLENDEQUATIONOESPROC) eglGetProcAddress("glBlendEquationOES");
	}
	if (FeatureAvailable[IRR_OES_blend_func_separate])
	{
		pGlBlendFuncSeparateOES = (PFNGLBLENDFUNCSEPARATEOESPROC) eglGetProcAddress("glBlendFuncSeparateOES");
	}
	if (FeatureAvailable[IRR_OES_framebuffer_object])
	{
		pGlBindRenderbufferOES = (PFNGLBINDRENDERBUFFEROES) eglGetProcAddress("glBindRenderbufferOES");
		pGlDeleteRenderbuffersOES = (PFNGLDELETERENDERBUFFERSOES) eglGetProcAddress("glDeletedRenderbuffersOES");
		pGlGenRenderbuffersOES = (PFNGLGENRENDERBUFFERSOES) eglGetProcAddress("glGenRenderbuffersOES");
		pGlRenderbufferStorageOES = (PFNGLRENDERBUFFERSTORAGEOES) eglGetProcAddress("glRenderbufferStorageOES");
		pGlBindFramebufferOES = (PFNGLBINDFRAMEBUFFEROES) eglGetProcAddress("glBindFramebufferOES");
		pGlDeleteFramebuffersOES = (PFNGLDELETEFRAMEBUFFERSOES) eglGetProcAddress("glDeleteFramebuffersOES");
		pGlGenFramebuffersOES = (PFNGLGENFRAMEBUFFERSOES) eglGetProcAddress("glGenFramebuffersOES");
		pGlCheckFramebufferStatusOES = (PFNGLCHECKFRAMEBUFFERSTATUSOES) eglGetProcAddress("glCheckFramebufferStatusOES");
		pGlFramebufferRenderbufferOES = (PFNGLFRAMEBUFFERRENDERBUFFEROES) eglGetProcAddress("glFramebufferRenderbufferOES");
		pGlFramebufferTexture2DOES = (PFNGLFRAMEBUFFERTEXTURE2DOES) eglGetProcAddress("glFramebufferTexture2DOES");
		pGlGenerateMipMapOES = (PFNGLGENERATEMIPMAPOES) eglGetProcAddress("glGenerateMipMapOES");
	}
#endif
#endif
}
Exemplo n.º 7
0
bool IsDesktop()
{
	if (GetEmulatedPlatformID() == PLATFORM_ID_ANDROID) return false;
	return true;
}