mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
Only show TouchBar reset button when enableReset is true
This commit is contained in:
parent
4b46d6e47d
commit
22138c855a
1 changed files with 8 additions and 1 deletions
|
@ -27,6 +27,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (retain,nonatomic) NSString *gameTitle;
|
@property (retain,nonatomic) NSString *gameTitle;
|
||||||
|
@property (retain,nonatomic) NSNumber *showResetButton;
|
||||||
|
|
||||||
-(void)updateFPSDisplay:(uint32_t)value;
|
-(void)updateFPSDisplay:(uint32_t)value;
|
||||||
@end
|
@end
|
||||||
|
@ -34,6 +35,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
@implementation MKXPZTouchBar
|
@implementation MKXPZTouchBar
|
||||||
|
|
||||||
@synthesize gameTitle;
|
@synthesize gameTitle;
|
||||||
|
@synthesize showResetButton;
|
||||||
|
|
||||||
+(MKXPZTouchBar*)sharedTouchBar {
|
+(MKXPZTouchBar*)sharedTouchBar {
|
||||||
if (!_sharedTouchBar)
|
if (!_sharedTouchBar)
|
||||||
|
@ -44,7 +46,11 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
-(instancetype)init {
|
-(instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
self.delegate = self;
|
self.delegate = self;
|
||||||
self.defaultItemIdentifiers = @[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"rebind", @"reset"];
|
|
||||||
|
NSMutableArray *items = [NSMutableArray arrayWithArray:@[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"rebind"]];
|
||||||
|
// Only show the reset button if resetting is enabled
|
||||||
|
if ([showResetButton boolValue]) [items addObject:@"reset"];
|
||||||
|
self.defaultItemIdentifiers = items;
|
||||||
|
|
||||||
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
||||||
fpsLabel.alignment = NSTextAlignmentCenter;
|
fpsLabel.alignment = NSTextAlignmentCenter;
|
||||||
|
@ -156,6 +162,7 @@ void initTouchBar(SDL_Window *win, Config &conf) {
|
||||||
windowinfo.info.cocoa.window.touchBar = MKXPZTouchBar.sharedTouchBar;
|
windowinfo.info.cocoa.window.touchBar = MKXPZTouchBar.sharedTouchBar;
|
||||||
MKXPZTouchBar.sharedTouchBar.parent = windowinfo.info.cocoa.window;
|
MKXPZTouchBar.sharedTouchBar.parent = windowinfo.info.cocoa.window;
|
||||||
MKXPZTouchBar.sharedTouchBar.gameTitle = @(conf.game.title.c_str());
|
MKXPZTouchBar.sharedTouchBar.gameTitle = @(conf.game.title.c_str());
|
||||||
|
MKXPZTouchBar.sharedTouchBar.showResetButton = [NSNumber numberWithBool:conf.enableReset];
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTouchBarFPSDisplay(uint32_t value) {
|
void updateTouchBarFPSDisplay(uint32_t value) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue