SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 9793e15f4db7c3bdf51cf376892ea2b95aec8f02 parent 670540116af7b9fea63cc69ad57e5034599c613a Author: Lior Halphon <LIJI32@gmail.com> Date: Thu, 9 Jan 2025 01:06:17 +0200 Fix the vertical layout being broken on certain iPad resolutions. Minor improvements to other iPad layouts. Fixes #678 Diffstat:
| M | iOS/GBHorizontalLayout.m | 7 | ++++--- |
| M | iOS/GBLayout.h | 2 | +- |
| M | iOS/GBLayout.m | 8 | ++++---- |
| M | iOS/GBVerticalLayout.m | 17 | ++++++++++------- |
4 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/iOS/GBHorizontalLayout.m b/iOS/GBHorizontalLayout.m @@ -35,8 +35,8 @@ break; } - double screenBorderWidth = screenRect.size.width / 40; - + double screenBorderWidth = MIN(screenRect.size.width / 40, 16 * self.factor); + screenRect.origin.x = (resolution.width - screenRect.size.width) / 2; bool drawSameBoyLogo = false; if (verticalMargin * 2 > screenBorderWidth * 7) { @@ -100,7 +100,8 @@ if (drawSameBoyLogo) { double bezelBottom = screenRect.origin.y + screenRect.size.height + screenBorderWidth; double freeSpace = resolution.height - bezelBottom; - [self drawLogoInVerticalRange:(NSRange){bezelBottom + screenBorderWidth * 2, freeSpace - screenBorderWidth * 4}]; + [self drawLogoInVerticalRange:(NSRange){bezelBottom + screenBorderWidth * 2, freeSpace - screenBorderWidth * 4} + controlPadding:0]; } [self drawLabels]; diff --git a/iOS/GBLayout.h b/iOS/GBLayout.h @@ -41,7 +41,7 @@ - (void)drawBackground; - (void)drawScreenBezels; -- (void)drawLogoInVerticalRange:(NSRange)range; +- (void)drawLogoInVerticalRange:(NSRange)range controlPadding:(double)padding; - (void)drawLabels; - (void)drawThemedLabelsWithBlock:(void (^)(void))block; diff --git a/iOS/GBLayout.m b/iOS/GBLayout.m @@ -93,7 +93,7 @@ static bool HasHomeBar(void) CGColorRef colors[] = {top, bottom}; CFArrayRef colorsArray = CFArrayCreate(NULL, (const void **)colors, 2, &kCFTypeArrayCallBacks); - double borderWidth = self.screenRect.size.width / 40; + double borderWidth = MIN(self.screenRect.size.width / 40, 16 * _factor); CGRect bezelRect = self.screenRect; bezelRect.origin.x -= borderWidth; bezelRect.origin.y -= borderWidth; @@ -140,7 +140,7 @@ static bool HasHomeBar(void) CFRelease(colorspace); } -- (void)drawLogoInVerticalRange:(NSRange)range +- (void)drawLogoInVerticalRange:(NSRange)range controlPadding:(double)padding { UIFont *font = [UIFont fontWithName:@"AvenirNext-BoldItalic" size:range.length * 4 / 3]; @@ -160,8 +160,8 @@ static bool HasHomeBar(void) }]; _logoRect = (CGRect){ - {(self.size.width - _screenRect.size.width) / 2, rect.origin.y}, - {_screenRect.size.width, rect.size.height} + {(self.size.width - _screenRect.size.width) / 2 + padding, rect.origin.y}, + {_screenRect.size.width - padding * 2, rect.size.height} }; } diff --git a/iOS/GBVerticalLayout.m b/iOS/GBVerticalLayout.m @@ -18,12 +18,11 @@ screenRect.origin.y = (resolution.height - screenRect.size.height) / 2; self.fullScreenRect = screenRect; - double screenBorderWidth = screenRect.size.width / 40; - screenRect.origin.x = (resolution.width - screenRect.size.width) / 2; - screenRect.origin.y = self.minY + screenBorderWidth * 2; + double screenBorderWidth = MIN(screenRect.size.width / 40, 16 * self.factor); + screenRect.origin.y = self.minY + MIN(screenBorderWidth * 2, 20 * self.factor); self.screenRect = screenRect; - double controlAreaStart = screenRect.origin.y + screenRect.size.height + screenBorderWidth * 2; + double controlAreaStart = screenRect.origin.y + screenRect.size.height + MIN(screenBorderWidth * 2, 20 * self.factor); self.selectLocation = (CGPoint){ MIN(resolution.width / 4, 120 * self.factor), @@ -74,9 +73,13 @@ [self drawScreenBezels]; [self drawThemedLabelsWithBlock:^{ - if (controlsTop - controlAreaStart > 24 * self.factor + screenBorderWidth * 2 || - middleSpace > 160 * self.factor) { - [self drawLogoInVerticalRange:(NSRange){controlAreaStart + screenBorderWidth, 24 * self.factor}]; + if (controlsTop - controlAreaStart > 24 * self.factor + screenBorderWidth * 2) { + [self drawLogoInVerticalRange:(NSRange){controlAreaStart + screenBorderWidth, 24 * self.factor} + controlPadding:0]; + } + else if (middleSpace > 160 * self.factor) { + [self drawLogoInVerticalRange:(NSRange){controlAreaStart + screenBorderWidth, 24 * self.factor} + controlPadding:self.dpadLocation.x * 2]; } [self drawLabels];
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.