mirror of https://github.com/LIJI32/SameBoy.git
Can't permanently disable the Home Bar, so the Safe Area must be followed :(
This commit is contained in:
parent
2530370f90
commit
e0b77d3821
|
@ -11,13 +11,13 @@
|
|||
CGSize resolution = {self.resolution.height - self.cutout, self.resolution.width};
|
||||
|
||||
CGRect screenRect = {0,};
|
||||
screenRect.size.height = self.hasFractionalPixels? resolution.height : floor(resolution.height / 144) * 144;
|
||||
screenRect.size.height = self.hasFractionalPixels? resolution.height : floor((resolution.height - self.homeBar) / 144) * 144;
|
||||
screenRect.size.width = screenRect.size.height / 144 * 160;
|
||||
|
||||
double horizontalMargin, verticalMargin;
|
||||
while (true) {
|
||||
horizontalMargin = (resolution.width - screenRect.size.width) / 2;
|
||||
verticalMargin = (resolution.height - screenRect.size.height) / 2;
|
||||
verticalMargin = (resolution.height - self.homeBar - screenRect.size.height) / 2;
|
||||
if (horizontalMargin / self.factor < 164) {
|
||||
if (self.hasFractionalPixels) {
|
||||
screenRect.size.width = resolution.width - 164 * self.factor * 2;
|
||||
|
@ -37,10 +37,10 @@
|
|||
bool drawSameBoyLogo = false;
|
||||
if (verticalMargin * 2 > screenBorderWidth * 7) {
|
||||
drawSameBoyLogo = true;
|
||||
screenRect.origin.y = (resolution.height - screenRect.size.height - screenBorderWidth * 5) / 2;
|
||||
screenRect.origin.y = (resolution.height - self.homeBar - screenRect.size.height - screenBorderWidth * 5) / 2;
|
||||
}
|
||||
else {
|
||||
screenRect.origin.y = (resolution.height - screenRect.size.height) / 2;
|
||||
screenRect.origin.y = (resolution.height - self.homeBar - screenRect.size.height) / 2;
|
||||
}
|
||||
|
||||
self.screenRect = screenRect;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
@property (readonly) CGSize resolution;
|
||||
@property (readonly) unsigned factor;
|
||||
@property (readonly) unsigned minY;
|
||||
@property (readonly) unsigned homeBar;
|
||||
@property (readonly) unsigned cutout;
|
||||
@property (readonly) bool hasFractionalPixels;
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
ignoreHidden:true] * _factor;
|
||||
_cutout = _minY <= 24 * _factor? 0 : _minY;
|
||||
|
||||
if ([UIApplication sharedApplication].windows[0].safeAreaInsets.bottom) {
|
||||
_homeBar = 21 * _factor;
|
||||
}
|
||||
|
||||
// The Plus series will scale things lossily anyway, so no need to bother with integer scale things
|
||||
// This also "catches" zoomed display modes
|
||||
_hasFractionalPixels = _factor != [UIScreen mainScreen].nativeScale;
|
||||
|
|
|
@ -271,10 +271,16 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
|||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden
|
||||
{
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
|
||||
{
|
||||
return UIRectEdgeTop;
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue