mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Set up multitouch querying.
This commit is contained in:
parent
d74c49f4cd
commit
7458f7888f
@ -415,6 +415,8 @@ static int16_t android_input_state(void *data, const struct retro_keybind **bind
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return ((state[port] & binds[port][id].joykey) && (port < pads_connected));
|
||||
case RETRO_DEVICE_POINTER:
|
||||
if (index != 0) // TODO: Multitouch.
|
||||
return 0;
|
||||
switch(id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
|
4
gfx/gl.c
4
gfx/gl.c
@ -1286,7 +1286,7 @@ static void gl_set_nonblock_state(void *data, bool state)
|
||||
context_swap_interval_func(state ? 0 : 1);
|
||||
}
|
||||
|
||||
static bool resolve_extensions(gl_t *gl)
|
||||
static bool resolve_extensions(gl_t *gl, bool rgb32)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Win32 GL lib doesn't have some elementary functions needed.
|
||||
@ -1467,7 +1467,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
#endif
|
||||
|
||||
if (!resolve_extensions(gl))
|
||||
if (!resolve_extensions(gl, video->rgb32))
|
||||
{
|
||||
context_destroy_func();
|
||||
free(gl);
|
||||
|
@ -237,8 +237,11 @@ static int16_t dinput_mouse_state(struct dinput_input *di, unsigned id)
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t dinput_pointer_state(struct dinput_input *di, unsigned id)
|
||||
static int16_t dinput_pointer_state(struct dinput_input *di, unsigned index, unsigned id)
|
||||
{
|
||||
if (index != 0)
|
||||
return 0;
|
||||
|
||||
int16_t res_x = 0, res_y = 0;
|
||||
bool valid = input_translate_coord_viewport(di->mouse_x, di->mouse_y, &res_x, &res_y);
|
||||
|
||||
@ -284,7 +287,7 @@ static int16_t dinput_input_state(void *data,
|
||||
return dinput_mouse_state(di, id);
|
||||
|
||||
case RETRO_DEVICE_POINTER:
|
||||
return dinput_pointer_state(di, id);
|
||||
return dinput_pointer_state(di, index, id);
|
||||
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
return dinput_lightgun_state(di, id);
|
||||
|
@ -120,8 +120,11 @@ static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t sdl_pointer_device_state(sdl_input_t *sdl, unsigned id)
|
||||
static int16_t sdl_pointer_device_state(sdl_input_t *sdl, unsigned index, unsigned id)
|
||||
{
|
||||
if (index != 0)
|
||||
return 0;
|
||||
|
||||
int16_t res_x = 0, res_y = 0;
|
||||
bool valid = input_translate_coord_viewport(sdl->mouse_abs_x, sdl->mouse_abs_y, &res_x, &res_y);
|
||||
|
||||
@ -182,7 +185,7 @@ static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds,
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
return sdl_mouse_device_state(data, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
return sdl_pointer_device_state(data, id);
|
||||
return sdl_pointer_device_state(data, index, id);
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return sdl_keyboard_device_state(data, id);
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
|
@ -107,8 +107,11 @@ static int16_t x_mouse_state(x11_input_t *x11, unsigned id)
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t x_pointer_state(x11_input_t *x11, unsigned id)
|
||||
static int16_t x_pointer_state(x11_input_t *x11, unsigned index, unsigned id)
|
||||
{
|
||||
if (index != 0)
|
||||
return 0;
|
||||
|
||||
int16_t res_x = 0, res_y = 0;
|
||||
bool valid = input_translate_coord_viewport(x11->mouse_x, x11->mouse_y, &res_x, &res_y);
|
||||
|
||||
@ -177,7 +180,7 @@ static int16_t x_input_state(void *data, const struct retro_keybind **binds, uns
|
||||
return x_mouse_state(x11, id);
|
||||
|
||||
case RETRO_DEVICE_POINTER:
|
||||
return x_pointer_state(x11, id);
|
||||
return x_pointer_state(x11, index, id);
|
||||
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
return x_lightgun_state(x11, id);
|
||||
|
20
retroarch.c
20
retroarch.c
@ -472,19 +472,19 @@ size_t audio_sample_batch(const int16_t *data, size_t frames)
|
||||
#ifdef HAVE_OVERLAY
|
||||
static inline void input_poll_overlay(void)
|
||||
{
|
||||
bool pressed = input_input_state_func(NULL, 0,
|
||||
RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
|
||||
driver.overlay_state = 0;
|
||||
if (!pressed)
|
||||
return;
|
||||
|
||||
int16_t x = input_input_state_func(NULL, 0,
|
||||
RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X);
|
||||
int16_t y = input_input_state_func(NULL, 0,
|
||||
RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y);
|
||||
for (unsigned i = 0;
|
||||
input_input_state_func(NULL, 0, RETRO_DEVICE_POINTER, i, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
i++)
|
||||
{
|
||||
int16_t x = input_input_state_func(NULL, 0,
|
||||
RETRO_DEVICE_POINTER, i, RETRO_DEVICE_ID_POINTER_X);
|
||||
int16_t y = input_input_state_func(NULL, 0,
|
||||
RETRO_DEVICE_POINTER, i, RETRO_DEVICE_ID_POINTER_Y);
|
||||
|
||||
driver.overlay_state = input_overlay_poll(driver.overlay, x, y);
|
||||
driver.overlay_state |= input_overlay_poll(driver.overlay, x, y);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user