Works on touchscreen devices and with mouse

This commit is contained in:
meepingsnesroms
2018-11-11 16:55:50 -08:00
parent f8c93880c3
commit ee3795396d

View File

@@ -275,8 +275,8 @@ void retro_run(void){
}
else{
//use RetroArch internal pointer
palmInput.touchscreenX = ((float)input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) / 0x7FFF + 1.0) / 0.5 * 159;
palmInput.touchscreenY = ((float)input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) / 0x7FFF + 1.0) / 0.5 * 219;
palmInput.touchscreenX = ((float)input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) / 0x7FFF + 1.0) / 2.0 * 159;
palmInput.touchscreenY = ((float)input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) / 0x7FFF + 1.0) / 2.0 * 219;
palmInput.touchscreenTouched = input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
}
@@ -301,12 +301,8 @@ void retro_run(void){
memcpy(screenData, screenHires ? palmExtendedFramebuffer : palmFramebuffer, screenWidth * screenHeight * sizeof(uint16_t));
//draw mouse
#if defined(FRONTEND_HAS_TOUCHSCREEN)
if(useJoystickAsMouse)
renderMouseCursor(palmInput.touchscreenX, palmInput.touchscreenY);
#else
renderMouseCursor(palmInput.touchscreenX, palmInput.touchscreenY);
#endif
video_cb(screenData, screenWidth, screenHeight, screenWidth * sizeof(uint16_t));
audio_cb(palmAudio, AUDIO_SAMPLES_PER_FRAME);