(GL) Fix build for HAVE_OPENGLES target

(Android) Input - add device ID per joypad
This commit is contained in:
twinaphex 2012-10-28 03:14:50 +01:00
parent 43602b97c9
commit aefb3ee3af
2 changed files with 15 additions and 14 deletions

View File

@ -27,23 +27,24 @@ static float AMotionEvent_getAxisValue(const AInputEvent* motion_event, int32_t
static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
{ {
float x,y; float x,y;
int action, keycode, source, type; int action, keycode, source, type, id;
action = AKEY_EVENT_NO_ACTION; action = AKEY_EVENT_NO_ACTION;
type = AInputEvent_getType(event); type = AInputEvent_getType(event);
source = AInputEvent_getSource(event); source = AInputEvent_getSource(event);
id = AInputEvent_getDeviceId(event);
switch(type) switch(type)
{ {
case AINPUT_EVENT_TYPE_KEY: case AINPUT_EVENT_TYPE_KEY:
action = AKeyEvent_getAction(event); action = AKeyEvent_getAction(event);
keycode = AKeyEvent_getKeyCode(event); keycode = AKeyEvent_getKeyCode(event);
RARCH_LOG("AINPUT_EVENT_TYPE_KEY.\n"); RARCH_LOG("AINPUT_EVENT_TYPE_KEY, id: %d.\n", id);
break; break;
case AINPUT_EVENT_TYPE_MOTION: case AINPUT_EVENT_TYPE_MOTION:
x = AMotionEvent_getX(event, 0); x = AMotionEvent_getX(event, 0);
y = AMotionEvent_getY(event, 0); y = AMotionEvent_getY(event, 0);
RARCH_LOG("AINPUT_EVENT_TYPE_MOTION - x: %f, y: %f.\n", x, y); RARCH_LOG("AINPUT_EVENT_TYPE_MOTION, id: %d, x: %f, y: %f.\n", id, x, y);
break; break;
} }
@ -56,16 +57,16 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
switch(action) switch(action)
{ {
case AKEY_EVENT_ACTION_DOWN: case AKEY_EVENT_ACTION_DOWN:
RARCH_LOG("AKEY_EVENT_ACTION_DOWN, keycode: %d.\n", keycode); RARCH_LOG("AKEY_EVENT_ACTION_DOWN, id: %d, keycode: %d.\n", id, keycode);
break; break;
case AKEY_EVENT_ACTION_UP: case AKEY_EVENT_ACTION_UP:
RARCH_LOG("AKEY_EVENT_ACTION_UP, keycode: %d.\n", keycode); RARCH_LOG("AKEY_EVENT_ACTION_UP, id: %d, keycode: %d.\n", id, keycode);
break; break;
case AKEY_EVENT_ACTION_MULTIPLE: case AKEY_EVENT_ACTION_MULTIPLE:
RARCH_LOG("AKEY_EVENT_ACTION_MULTIPLE, keycode: %d.\n", keycode); RARCH_LOG("AKEY_EVENT_ACTION_MULTIPLE, id: %d, keycode: %d.\n", id, keycode);
break; break;
default: default:
RARCH_LOG("AKEY_EVENT_NO_ACTION.\n"); RARCH_LOG("AKEY_EVENT_NO_ACTION, id: %d, keycode: %d.\n", id, keycode);
break; break;
} }
} }
@ -73,19 +74,19 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
switch(source) switch(source)
{ {
case AINPUT_SOURCE_DPAD: case AINPUT_SOURCE_DPAD:
RARCH_LOG("AINPUT_SOURCE_DPAD.\n"); RARCH_LOG("AINPUT_SOURCE_DPAD, id: %d, keycode: %d.\n", id, keycode);
break; break;
case AINPUT_SOURCE_TOUCHSCREEN: case AINPUT_SOURCE_TOUCHSCREEN:
RARCH_LOG("AINPUT_SOURCE_TOUCHSCREEN.\n"); RARCH_LOG("AINPUT_SOURCE_TOUCHSCREEN, id: %d, keycode: %d.\n", id, keycode);
break; break;
case AINPUT_SOURCE_TOUCHPAD: case AINPUT_SOURCE_TOUCHPAD:
RARCH_LOG("AINPUT_SOURCE_TOUCHPAD.\n"); RARCH_LOG("AINPUT_SOURCE_TOUCHPAD, id: %d, keycode: %d.\n", id, keycode);
break; break;
case AINPUT_SOURCE_ANY: case AINPUT_SOURCE_ANY:
RARCH_LOG("AINPUT_SOURCE_ANY.\n"); RARCH_LOG("AINPUT_SOURCE_ANY, id: %d, keycode: %d.\n", id, keycode);
break; break;
default: default:
RARCH_LOG("AINPUT_SOURCE_DEFAULT.\n"); RARCH_LOG("AINPUT_SOURCE_DEFAULT, id: %d, keycode: %d.\n", id, keycode);
break; break;
} }

View File

@ -1512,8 +1512,8 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
#ifdef HAVE_OPENGLES #ifdef HAVE_OPENGLES
glReadPixels(vp[0], vp[1], glReadPixels(gl->vp.x, gl->vp.y,
vp[2], vp[3], gl->vp.width, gl->vp.height,
GL_RGB, GL_UNSIGNED_BYTE, buffer); GL_RGB, GL_UNSIGNED_BYTE, buffer);
uint8_t *pixels = (uint8_t*)buffer; uint8_t *pixels = (uint8_t*)buffer;