Added preprocessor directives to most Android-specific changes
This commit is contained in:
		
							parent
							
								
									3482ec01b7
								
							
						
					
					
						commit
						40f2cc28e9
					
				
					 6 changed files with 35 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -1079,8 +1079,13 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
			
		|||
	Vec2i gpTexSize;
 | 
			
		||||
	shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
 | 
			
		||||
 | 
			
		||||
	/* Disable alpha for more performance*/
 | 
			
		||||
	bool fastBlit = !p->touchesTaintedArea(posRect); //&& txtAlpha == 1.0f;
 | 
			
		||||
	/* FIXME: Disable alpha while fastblitting 
 | 
			
		||||
	 * for more performance on mobile devices */
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
	bool fastBlit = !p->touchesTaintedArea(posRect);
 | 
			
		||||
#else
 | 
			
		||||
	bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (fastBlit)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -1197,8 +1202,12 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	SDL_FreeSurface(txtSurf);
 | 
			
		||||
	/* Remove this for a performance advantage, with a risk */
 | 
			
		||||
	/* p->addTaintedArea(posRect); */
 | 
			
		||||
	
 | 
			
		||||
	/* FIXME: Marking text areas as tainted
 | 
			
		||||
	 * creates performance issues on Android */
 | 
			
		||||
#ifndef __ANDROID__
 | 
			
		||||
	p->addTaintedArea(posRect);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	p->onModified();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -145,7 +145,11 @@ std::set<T> setFromVec(const std::vector<T> &vec)
 | 
			
		|||
typedef std::vector<std::string> StringVec;
 | 
			
		||||
namespace po = boost::program_options;
 | 
			
		||||
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
#define CONF_FILE FULL_MKXP_PATH
 | 
			
		||||
#else
 | 
			
		||||
#define CONF_FILE "mkxp.conf"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
Config::Config()
 | 
			
		||||
{}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -324,11 +324,12 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
				rtData.rqReset.set();
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
			if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
 | 
			
		||||
			{
 | 
			
		||||
				mouseState.buttons[SDL_BUTTON_RIGHT] = true;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
			keyStates[event.key.keysym.scancode] = true;
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -345,10 +346,12 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
			keyStates[event.key.keysym.scancode] = false;
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
			if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
 | 
			
		||||
			{
 | 
			
		||||
				mouseState.buttons[SDL_BUTTON_RIGHT] = false;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -406,7 +409,9 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
		case SDL_FINGERUP :
 | 
			
		||||
			i = event.tfinger.fingerId;
 | 
			
		||||
			memset(&touchState.fingers[i], 0, sizeof(touchState.fingers[0]));
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
			touchState.ignoreMouse = false;
 | 
			
		||||
#endif
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		default :
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,9 @@ public:
 | 
			
		|||
 | 
			
		||||
	struct TouchState
 | 
			
		||||
	{
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
		bool ignoreMouse;
 | 
			
		||||
#endif
 | 
			
		||||
		FingerState fingers[MAX_FINGERS];
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -276,7 +276,9 @@ struct OlBinding : public Binding
 | 
			
		|||
				if ((x >= olb.x && x <= olb.x + olb.u.r.width)
 | 
			
		||||
				&&   y >= olb.y && y <= olb.y + olb.u.r.height)
 | 
			
		||||
				{
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
					EventThread::touchState.ignoreMouse = true;
 | 
			
		||||
#endif
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -290,7 +292,9 @@ struct OlBinding : public Binding
 | 
			
		|||
 | 
			
		||||
				if (d <= olb.u.c.radius)
 | 
			
		||||
				{
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
					EventThread::touchState.ignoreMouse = true;
 | 
			
		||||
#endif
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -306,7 +310,9 @@ struct OlBinding : public Binding
 | 
			
		|||
 | 
			
		||||
				if ((s0 == s1) && (s1 == s2))
 | 
			
		||||
				{
 | 
			
		||||
#ifdef __ANDROID__
 | 
			
		||||
					EventThread::touchState.ignoreMouse = true;
 | 
			
		||||
#endif
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,6 +102,10 @@ int rgssThreadFun(void *userdata)
 | 
			
		|||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* WORKAROUND: Disable blitting on Adreno devices
 | 
			
		||||
	 * Many old generation devices have multiple rendering
 | 
			
		||||
	 * issues including broken tilesets and text
 | 
			
		||||
	 * TODO: Find a real fix for this */
 | 
			
		||||
	std::string RendererName = glGetStringInt(GL_RENDERER);
 | 
			
		||||
	bool checkAdreno = RendererName.find("Adreno") != std::string::npos;
 | 
			
		||||
	if (!conf.enableBlitting || checkAdreno)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue