Added spinner
This commit is contained in:
parent
de30f6a28d
commit
a389178a5d
|
@ -17,6 +17,7 @@
|
|||
@interface AppDelegate : NSObject <NSApplicationDelegate, FBScreenViewDelegate, FBMainThreadDelegate>
|
||||
{
|
||||
IBOutlet FBScreenView *screen;
|
||||
IBOutlet NSView *spinner;
|
||||
}
|
||||
|
||||
+ (AppDelegate *) sharedInstance;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// FIXME: errors during load
|
||||
// FIXME: starting without ROM selected
|
||||
// FIXME: dropping file into window
|
||||
// FIXME: sound when load fails
|
||||
// FIXME: focus on visibility toggle
|
||||
@interface AppDelegate ()
|
||||
|
||||
@property (weak) IBOutlet NSWindow *window;
|
||||
|
@ -27,6 +27,7 @@ static AppDelegate *sharedInstance = nil;
|
|||
{
|
||||
FBMainThread *main;
|
||||
BOOL _cursorVisible;
|
||||
NSTitlebarAccessoryViewController *tbAccessory;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -39,14 +40,19 @@ static AppDelegate *sharedInstance = nil;
|
|||
- (void) awakeFromNib
|
||||
{
|
||||
sharedInstance = self;
|
||||
_video = [FBVideo new];
|
||||
_input = [FBInput new];
|
||||
main = [FBMainThread new];
|
||||
|
||||
_input = [FBInput new];
|
||||
_cursorVisible = YES;
|
||||
|
||||
tbAccessory = [NSTitlebarAccessoryViewController new];
|
||||
tbAccessory.view = spinner;
|
||||
tbAccessory.layoutAttribute = NSLayoutAttributeRight;
|
||||
|
||||
main = [FBMainThread new];
|
||||
main.delegate = self;
|
||||
screen.delegate = self;
|
||||
_video = [FBVideo new];
|
||||
_video.delegate = screen;
|
||||
screen.delegate = self;
|
||||
}
|
||||
|
||||
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
|
@ -138,11 +144,26 @@ static AppDelegate *sharedInstance = nil;
|
|||
if (screenSize.width != 0 && screenSize.height != 0)
|
||||
[self resizeFrame:NSMakeSize(screenSize.width * 2, screenSize.height * 2)
|
||||
animate:NO];
|
||||
|
||||
screen.hidden = NO;
|
||||
}
|
||||
|
||||
- (void) gameSessionDidEnd
|
||||
{
|
||||
NSLog(@"gameSessionDidEnd");
|
||||
screen.hidden = YES;
|
||||
}
|
||||
|
||||
- (void) driverInitDidStart
|
||||
{
|
||||
[spinner.subviews.firstObject startAnimation:self];
|
||||
[_window addTitlebarAccessoryViewController:tbAccessory];
|
||||
}
|
||||
|
||||
- (void) driverInitDidEnd:(BOOL) success
|
||||
{
|
||||
[spinner.subviews.firstObject stopAnimation:self];
|
||||
[tbAccessory removeFromParentViewController];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
|
||||
<connections>
|
||||
<outlet property="screen" destination="Jj9-3G-U07" id="7Fv-Ip-Vmf"/>
|
||||
<outlet property="spinner" destination="LUr-2W-WhR" id="BLW-Aq-ioS"/>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
|
@ -181,5 +182,16 @@
|
|||
</connections>
|
||||
<point key="canvasLocation" x="131" y="-153"/>
|
||||
</window>
|
||||
<customView id="LUr-2W-WhR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="24" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<progressIndicator wantsLayer="YES" fixedFrame="YES" maxValue="100" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="XS4-h5-AoQ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
</progressIndicator>
|
||||
</subviews>
|
||||
<point key="canvasLocation" x="66" y="-511"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
@protocol FBMainThreadDelegate<NSObject>
|
||||
|
||||
- (void) gameSessionDidStart: (NSString *) name;
|
||||
- (void) driverInitDidStart;
|
||||
- (void) driverInitDidEnd:(BOOL) success;
|
||||
- (void) gameSessionDidStart:(NSString *) name;
|
||||
- (void) gameSessionDidEnd;
|
||||
|
||||
@end
|
||||
|
|
|
@ -44,9 +44,24 @@ extern int MainEnd();
|
|||
NSString *setPath = [[pathToLoad stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
||||
NSString *setName = [[pathToLoad lastPathComponent] stringByDeletingPathExtension];
|
||||
|
||||
{
|
||||
id<FBMainThreadDelegate> del = _delegate;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[del driverInitDidStart];
|
||||
});
|
||||
}
|
||||
|
||||
if (!MainInit([setPath cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
[setName cStringUsingEncoding:NSUTF8StringEncoding])) {
|
||||
pathToLoad = nil;
|
||||
|
||||
{
|
||||
id<FBMainThreadDelegate> del = _delegate;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[del driverInitDidEnd:NO];
|
||||
});
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -56,6 +71,7 @@ extern int MainEnd();
|
|||
{
|
||||
id<FBMainThreadDelegate> del = _delegate;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[del driverInitDidEnd:YES];
|
||||
[del gameSessionDidStart:setName];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -33,9 +33,10 @@ int MainInit(const char *path, const char *setname)
|
|||
}
|
||||
|
||||
bCheatsAllowed = false;
|
||||
|
||||
sprintf(szAppRomPaths[0], path);
|
||||
DrvInit(i, 0);
|
||||
|
||||
if (DrvInit(i, 0))
|
||||
return 0;
|
||||
|
||||
MediaInit();
|
||||
RunInit();
|
||||
|
|
Loading…
Reference in New Issue