mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
removed debug logging statements; enable multi touch on metal view to support touchscreen controls; fixed setting the metal view drawable size based on the view bounds size in pixels
This commit is contained in:
parent
eed84b3021
commit
a19f1451cd
@ -501,12 +501,15 @@
|
||||
- (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size
|
||||
{
|
||||
NSLog(@"mtkView drawableSizeWillChange to: %f x %f",size.width,size.height);
|
||||
// due to autolayout constraints?
|
||||
if (size.width == INFINITY || size.height == INFINITY) {
|
||||
NSLog(@"mtkView drawableSizeWillChange width or height is inifinity, skipping...");
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_COCOATOUCH
|
||||
CGFloat scale = [[UIScreen mainScreen] scale];
|
||||
// // due to autolayout constraints?
|
||||
//// if (size.width == INFINITY || size.height == INFINITY) {
|
||||
// NSLog(@"mtkView drawableSizeWillChange width or height is infinity, flipping...");
|
||||
[self setViewportWidth:(unsigned int)view.bounds.size.width*scale height:(unsigned int)view.bounds.size.height*scale forceFull:NO allowRotate:YES];
|
||||
#else
|
||||
[self setViewportWidth:(unsigned int)size.width height:(unsigned int)size.height forceFull:NO allowRotate:YES];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)drawInMTKView:(MTKView *)view
|
||||
|
@ -31196,8 +31196,6 @@ bool video_driver_translate_coord_viewport(
|
||||
int norm_vp_height = (int)vp->height;
|
||||
int norm_full_vp_width = (int)vp->full_width;
|
||||
int norm_full_vp_height = (int)vp->full_height;
|
||||
printf("yoshi debug: video size: %i, %i full size: %i, %i \n",norm_vp_width,norm_vp_height,norm_full_vp_width,norm_full_vp_height);
|
||||
printf("yoshi debug: video_driver_translate_coord_viewport: incoming mouse coord: %i,%i \n",mouse_x,mouse_y);
|
||||
if (norm_vp_width <= 0 ||
|
||||
norm_vp_height <= 0 ||
|
||||
norm_full_vp_width <= 0 ||
|
||||
@ -31235,7 +31233,6 @@ bool video_driver_translate_coord_viewport(
|
||||
*res_y = scaled_y;
|
||||
*res_screen_x = scaled_screen_x;
|
||||
*res_screen_y = scaled_screen_y;
|
||||
printf("yoshi debug: translated coordinates: res: (%i,%i) res_screen:(%i,%i) \n",scaled_x,scaled_y,scaled_screen_x,scaled_screen_y);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,6 @@ static void handle_touch_event(NSArray* touches)
|
||||
// continue;
|
||||
|
||||
coord = [touch locationInView:[touch view]];
|
||||
NSLog(@"yoshi debug: handle_touch_event: coord = %f,%f , scaled = %f,%f",coord.x,coord.y,coord.x*scale,coord.y*scale);
|
||||
|
||||
if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled)
|
||||
{
|
||||
apple->touches[apple->touch_count ].screen_x = coord.x * scale;
|
||||
@ -350,6 +348,7 @@ enum
|
||||
MetalView *v = [MetalView new];
|
||||
v.paused = YES;
|
||||
v.enableSetNeedsDisplay = NO;
|
||||
v.multipleTouchEnabled = YES;
|
||||
_renderView = v;
|
||||
}
|
||||
break;
|
||||
@ -365,8 +364,6 @@ enum
|
||||
return;
|
||||
}
|
||||
|
||||
// _renderView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
||||
// [_renderView setFrame:self.window.bounds];
|
||||
_renderView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
UIView *rootView = [CocoaView get].view;
|
||||
[rootView addSubview:_renderView];
|
||||
@ -374,10 +371,6 @@ enum
|
||||
[[_renderView.bottomAnchor constraintEqualToAnchor:rootView.bottomAnchor] setActive:YES];
|
||||
[[_renderView.leadingAnchor constraintEqualToAnchor:rootView.leadingAnchor] setActive:YES];
|
||||
[[_renderView.trailingAnchor constraintEqualToAnchor:rootView.trailingAnchor] setActive:YES];
|
||||
|
||||
|
||||
// [self.window addSubview:_renderView];
|
||||
// self.window.contentView.nextResponder = _listener;
|
||||
}
|
||||
|
||||
- (apple_view_type_t)viewType {
|
||||
@ -385,12 +378,13 @@ enum
|
||||
}
|
||||
|
||||
- (void)setVideoMode:(gfx_ctx_mode_t)mode {
|
||||
// hmm might need some scaling factor...
|
||||
MetalView *metalView = (MetalView*) _renderView;
|
||||
[metalView setDrawableSize:CGSizeMake(mode.width, mode.height)];
|
||||
NSLog(@"setVideoMode set drawable size to %i x %i",mode.width,mode.height);
|
||||
// hardcoding test!
|
||||
[metalView setDrawableSize:CGSizeMake(1242.0,2668.0)];
|
||||
CGFloat scale = [[UIScreen mainScreen] scale];
|
||||
[metalView setDrawableSize:CGSizeMake(
|
||||
_renderView.bounds.size.width * scale,
|
||||
_renderView.bounds.size.height * scale
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
- (void)setCursorVisible:(bool)v {
|
||||
|
Loading…
x
Reference in New Issue
Block a user