mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-13 05:10:42 +00:00
(Cocoa) No more dependencies on get_chosen_screen or
get_backing_scale_factor
This commit is contained in:
parent
f35690e2e5
commit
8323d06d3d
@ -141,7 +141,11 @@ static void cocoa_input_poll(void *data)
|
||||
uint32_t i;
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
|
||||
|
||||
for (i = 0; i < apple->touch_count; i++)
|
||||
{
|
||||
apple->touches[i].screen_x *= backing_scale_factor;
|
||||
apple->touches[i].screen_y *= backing_scale_factor;
|
||||
input_translate_coord_viewport(
|
||||
apple->touches[i].screen_x,
|
||||
apple->touches[i].screen_y,
|
||||
@ -149,6 +153,7 @@ static void cocoa_input_poll(void *data)
|
||||
&apple->touches[i].fixed_y,
|
||||
&apple->touches[i].full_x,
|
||||
&apple->touches[i].full_y);
|
||||
}
|
||||
|
||||
if (apple->joypad)
|
||||
apple->joypad->poll();
|
||||
@ -184,12 +189,14 @@ static int16_t cocoa_mouse_state(cocoa_input_data_t *apple,
|
||||
static int16_t cocoa_mouse_state_screen(cocoa_input_data_t *apple,
|
||||
unsigned id)
|
||||
{
|
||||
float backing_scale_factor = get_backing_scale_factor();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_MOUSE_X:
|
||||
return apple->window_pos_x;
|
||||
return (apple->window_pos_x * backing_scale_factor);
|
||||
case RETRO_DEVICE_ID_MOUSE_Y:
|
||||
return apple->window_pos_y;
|
||||
return (apple->window_pos_y * backing_scale_factor);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -33,9 +33,6 @@
|
||||
|
||||
static id apple_platform;
|
||||
|
||||
extern void *get_chosen_screen(void);
|
||||
extern float get_backing_scale_factor(void);
|
||||
|
||||
void apple_rarch_exited(void)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
@ -109,8 +106,7 @@ void apple_rarch_exited(void)
|
||||
NSPoint pos;
|
||||
NSPoint mouse_pos;
|
||||
apple = (cocoa_input_data_t*)input_driver_get_data();
|
||||
float backing_scale_factor = get_backing_scale_factor();
|
||||
if (!apple || (backing_scale_factor == 0.0))
|
||||
if (!apple)
|
||||
return;
|
||||
|
||||
/* Relative */
|
||||
@ -119,12 +115,12 @@ void apple_rarch_exited(void)
|
||||
|
||||
/* Absolute */
|
||||
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
apple->touches[0].screen_x = pos.x * backing_scale_factor;
|
||||
apple->touches[0].screen_y = pos.y * backing_scale_factor;
|
||||
apple->touches[0].screen_x = pos.x;
|
||||
apple->touches[0].screen_y = pos.y;
|
||||
|
||||
mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
apple->window_pos_x = (int16_t)mouse_pos.x * backing_scale_factor;
|
||||
apple->window_pos_y = (int16_t)mouse_pos.y * backing_scale_factor;
|
||||
apple->window_pos_x = (int16_t)mouse_pos.x;
|
||||
apple->window_pos_y = (int16_t)mouse_pos.y;
|
||||
}
|
||||
break;
|
||||
case NSScrollWheel:
|
||||
|
Loading…
x
Reference in New Issue
Block a user