Added preprocessor directives to most Android-specific changes
This commit is contained in:
parent
3482ec01b7
commit
40f2cc28e9
|
@ -1079,8 +1079,13 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
Vec2i gpTexSize;
|
Vec2i gpTexSize;
|
||||||
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
||||||
|
|
||||||
/* Disable alpha for more performance*/
|
/* FIXME: Disable alpha while fastblitting
|
||||||
bool fastBlit = !p->touchesTaintedArea(posRect); //&& txtAlpha == 1.0f;
|
* 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)
|
if (fastBlit)
|
||||||
{
|
{
|
||||||
|
@ -1197,8 +1202,12 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_FreeSurface(txtSurf);
|
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();
|
p->onModified();
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,11 @@ std::set<T> setFromVec(const std::vector<T> &vec)
|
||||||
typedef std::vector<std::string> StringVec;
|
typedef std::vector<std::string> StringVec;
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
#define CONF_FILE FULL_MKXP_PATH
|
#define CONF_FILE FULL_MKXP_PATH
|
||||||
|
#else
|
||||||
|
#define CONF_FILE "mkxp.conf"
|
||||||
|
#endif
|
||||||
|
|
||||||
Config::Config()
|
Config::Config()
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -324,11 +324,12 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
rtData.rqReset.set();
|
rtData.rqReset.set();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef __ANDROID__
|
||||||
if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
|
if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
|
||||||
{
|
{
|
||||||
mouseState.buttons[SDL_BUTTON_RIGHT] = true;
|
mouseState.buttons[SDL_BUTTON_RIGHT] = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
keyStates[event.key.keysym.scancode] = true;
|
keyStates[event.key.keysym.scancode] = true;
|
||||||
break;
|
break;
|
||||||
|
@ -345,10 +346,12 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
}
|
}
|
||||||
|
|
||||||
keyStates[event.key.keysym.scancode] = false;
|
keyStates[event.key.keysym.scancode] = false;
|
||||||
|
#ifdef __ANDROID__
|
||||||
if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
|
if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK)
|
||||||
{
|
{
|
||||||
mouseState.buttons[SDL_BUTTON_RIGHT] = false;
|
mouseState.buttons[SDL_BUTTON_RIGHT] = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -406,7 +409,9 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
case SDL_FINGERUP :
|
case SDL_FINGERUP :
|
||||||
i = event.tfinger.fingerId;
|
i = event.tfinger.fingerId;
|
||||||
memset(&touchState.fingers[i], 0, sizeof(touchState.fingers[0]));
|
memset(&touchState.fingers[i], 0, sizeof(touchState.fingers[0]));
|
||||||
|
#ifdef __ANDROID__
|
||||||
touchState.ignoreMouse = false;
|
touchState.ignoreMouse = false;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
|
@ -68,7 +68,9 @@ public:
|
||||||
|
|
||||||
struct TouchState
|
struct TouchState
|
||||||
{
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
bool ignoreMouse;
|
bool ignoreMouse;
|
||||||
|
#endif
|
||||||
FingerState fingers[MAX_FINGERS];
|
FingerState fingers[MAX_FINGERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,9 @@ struct OlBinding : public Binding
|
||||||
if ((x >= olb.x && x <= olb.x + olb.u.r.width)
|
if ((x >= olb.x && x <= olb.x + olb.u.r.width)
|
||||||
&& y >= olb.y && y <= olb.y + olb.u.r.height)
|
&& y >= olb.y && y <= olb.y + olb.u.r.height)
|
||||||
{
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
EventThread::touchState.ignoreMouse = true;
|
EventThread::touchState.ignoreMouse = true;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +292,9 @@ struct OlBinding : public Binding
|
||||||
|
|
||||||
if (d <= olb.u.c.radius)
|
if (d <= olb.u.c.radius)
|
||||||
{
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
EventThread::touchState.ignoreMouse = true;
|
EventThread::touchState.ignoreMouse = true;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +310,9 @@ struct OlBinding : public Binding
|
||||||
|
|
||||||
if ((s0 == s1) && (s1 == s2))
|
if ((s0 == s1) && (s1 == s2))
|
||||||
{
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
EventThread::touchState.ignoreMouse = true;
|
EventThread::touchState.ignoreMouse = true;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,10 @@ int rgssThreadFun(void *userdata)
|
||||||
return 0;
|
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);
|
std::string RendererName = glGetStringInt(GL_RENDERER);
|
||||||
bool checkAdreno = RendererName.find("Adreno") != std::string::npos;
|
bool checkAdreno = RendererName.find("Adreno") != std::string::npos;
|
||||||
if (!conf.enableBlitting || checkAdreno)
|
if (!conf.enableBlitting || checkAdreno)
|
||||||
|
|
Loading…
Reference in New Issue