mirror of https://github.com/encounter/SDL.git
Fixed setting the layer drawable size
Without this change the drawable had a size of 0 and the metal renderer asserted because the projection matrix wasn't set.
This commit is contained in:
parent
cef1c1c2ee
commit
ac2d1f6773
|
@ -60,7 +60,14 @@
|
||||||
/* Set the size of the metal drawables when the view is resized. */
|
/* Set the size of the metal drawables when the view is resized. */
|
||||||
- (void)layoutSubviews
|
- (void)layoutSubviews
|
||||||
{
|
{
|
||||||
|
CGSize bounds;
|
||||||
|
|
||||||
[super layoutSubviews];
|
[super layoutSubviews];
|
||||||
|
|
||||||
|
bounds = [self bounds].size;
|
||||||
|
bounds.width *= self.layer.contentsScale;
|
||||||
|
bounds.height *= self.layer.contentsScale;
|
||||||
|
((CAMetalLayer *) self.layer).drawableSize = bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -72,9 +79,9 @@ UIKit_Mtl_AddMetalView(SDL_Window* window)
|
||||||
SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view;
|
SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view;
|
||||||
CGFloat scale = 1.0;
|
CGFloat scale = 1.0;
|
||||||
|
|
||||||
if ([view isKindOfClass:[SDL_uikitmetalview class]]) {
|
if ([view isKindOfClass:[SDL_uikitmetalview class]]) {
|
||||||
return (SDL_uikitmetalview *)view;
|
return (SDL_uikitmetalview *)view;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||||
/* Set the scale to the natural scale factor of the screen - then
|
/* Set the scale to the natural scale factor of the screen - then
|
||||||
|
|
Loading…
Reference in New Issue