git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit d52a50353dcb6376125146bc562db705c2d5a4ba
parent 5d70f9392051a71fd3e7b5f4795a14b14bf86139
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 28 Jun 2025 14:40:42 +0300

Update the tips visuals

Diffstat:
MiOS/GBCheatsController.m3++-
MiOS/GBLayout.m2+-
MiOS/GBMenuViewController.m23++++++++++++++++++-----
MiOS/GBSlider.m2+-
4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/iOS/GBCheatsController.m b/iOS/GBCheatsController.m @@ -212,7 +212,8 @@ self.toolbarItems = @[export, flexItem, import, [UIBarButtonItem fixedSpaceItemOfWidth:0], add]; - } else { + } + else { self.toolbarItems = @[export, flexItem, import, add]; diff --git a/iOS/GBLayout.m b/iOS/GBLayout.m @@ -1,7 +1,7 @@ #define GBLayoutInternal #import "GBLayout.h" -static double StatusBarHeight(void) +double StatusBarHeight(void) { static double ret = 0; static dispatch_once_t onceToken; diff --git a/iOS/GBMenuViewController.m b/iOS/GBMenuViewController.m @@ -30,6 +30,7 @@ static NSString *const tips[] = { UILabel *_tipLabel; UIVisualEffectView *_effectView; NSMutableArray<UIButton *> *_buttons; + unsigned _superviewTopInset; } + (instancetype)menu @@ -109,7 +110,15 @@ static NSString *const tips[] = { self.menuButtons = [_buttons copy]; [self updateSelectedButton]; - _effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleProminent]]; + UIVisualEffect *effect = nil; + if (@available(iOS 19.0, *)) { + effect = [[objc_getClass("UIGlassEffect") alloc] init]; + } + else { + effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleProminent]; + } + + _effectView = [[UIVisualEffectView alloc] initWithEffect:effect]; _effectView.layer.cornerRadius = 8; _effectView.layer.masksToBounds = true; [self.view.superview addSubview:_effectView]; @@ -127,9 +136,11 @@ static NSString *const tips[] = { [_effectView.contentView addSubview:_tipLabel]; [self layoutTip]; _effectView.alpha = 0; - [UIView animateWithDuration:0.25 animations:^{ - _effectView.alpha = 1.0; - }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [UIView animateWithDuration:0.25 animations:^{ + _effectView.alpha = 1.0; + }]; + }); } - (void)layoutTip @@ -142,8 +153,10 @@ static NSString *const tips[] = { limitedToNumberOfLines:3].size; size.width = ceil(size.width); _tipLabel.frame = (CGRect){{8, 8}, size}; + // Weird iOS bug where the inset reports as 0 after some rotations, use the helper function from GBLayout + extern double StatusBarHeight(void); _effectView.frame = (CGRect) { - {round((outerSize.width - size.width - 16) / 2), view.window.safeAreaInsets.top + 12}, + {round((outerSize.width - size.width - 16) / 2), StatusBarHeight() + 12}, {size.width + 16, size.height + 16} }; } diff --git a/iOS/GBSlider.m b/iOS/GBSlider.m @@ -173,7 +173,7 @@ static inline void temperature_tint(double temperature, double *r, double *g, do - (void)setStyle:(GBSliderStyle)style { _style = style; - if (@available(iOS 26.0, *)) { + if (@available(iOS 19.0, *)) { switch (_style) { case GBSliderStyleTemperature: case GBSliderStyleTicks: {

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.