mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
ANDROIDSDL: code optimization
This commit is contained in:
parent
9cdda5c045
commit
2d7803c22f
@ -26,7 +26,6 @@
|
||||
|
||||
#include "backends/events/androidsdl/androidsdl-events.h"
|
||||
#include "backends/platform/androidsdl/androidsdl-sdl.h"
|
||||
#include <SDL_screenkeyboard.h>
|
||||
|
||||
bool AndroidSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
@ -43,16 +42,9 @@ bool AndroidSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &
|
||||
else if (ev.button.button == SDL_BUTTON_MIDDLE) {
|
||||
event.type = Common::EVENT_MBUTTONDOWN;
|
||||
|
||||
static int show_onscreen = 0;
|
||||
if (show_onscreen == 0) {
|
||||
SDL_ANDROID_SetScreenKeyboardShown(0);
|
||||
show_onscreen++;
|
||||
} else if (show_onscreen==1) {
|
||||
SDL_ANDROID_SetScreenKeyboardShown(1);
|
||||
show_onscreen++;
|
||||
}
|
||||
if (show_onscreen == 2)
|
||||
show_onscreen = 0;
|
||||
static bool show_onscreen = g_system->getFeatureState(OSystem::kFeatureOnScreenControl);
|
||||
show_onscreen = !show_onscreen;
|
||||
g_system->setFeatureState(OSystem::kFeatureOnScreenControl, show_onscreen);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
@ -97,3 +97,17 @@ void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) {
|
||||
|
||||
OSystem_POSIX::setFeatureState(f, enable);
|
||||
}
|
||||
|
||||
bool OSystem_ANDROIDSDL::getFeatureState(Feature f) {
|
||||
switch (f) {
|
||||
case kFeatureTouchpadMode:
|
||||
return ConfMan.getBool("touchpad_mouse_mode");
|
||||
break;
|
||||
case kFeatureOnScreenControl:
|
||||
return ConfMan.getBool("onscreen_control");
|
||||
break;
|
||||
default:
|
||||
return OSystem_POSIX::getFeatureState(f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class OSystem_ANDROIDSDL : public OSystem_POSIX {
|
||||
public:
|
||||
virtual void initBackend();
|
||||
virtual void setFeatureState(Feature f, bool enable);
|
||||
virtual bool getFeatureState(Feature f);
|
||||
void touchpadMode(bool enable);
|
||||
void switchToDirectMouseMode();
|
||||
void switchToRelativeMouseMode();
|
||||
|
Loading…
Reference in New Issue
Block a user