project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 6908 896ed2afcfb8
parent 6866 efdd2e4fc45c
child 7048 0a4c88935902
equal deleted inserted replaced
6907:a2f9a9a62dc5 6908:896ed2afcfb8
    23 // the reference to the newMenu instance
    23 // the reference to the newMenu instance
    24 static OverlayViewController *overlay_instance;
    24 static OverlayViewController *overlay_instance;
    25 
    25 
    26 #pragma mark -
    26 #pragma mark -
    27 #pragma mark functions called by pascal code
    27 #pragma mark functions called by pascal code
    28 BOOL inline isApplePhone() {
    28 BOOL inline isApplePhone(void) {
    29     return (IS_IPAD() == NO);
    29     return (IS_IPAD() == NO);
    30 }
    30 }
    31 
    31 
    32 void startLoadingIndicator() {
    32 void startLoadingIndicator(void) {
    33     // this is the first ojbc function called by engine, so we have to initialize some variables here
    33     // this is the first ojbc function called by engine, so we have to initialize some variables here
    34     overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
    34     overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
    35     // in order to get rotation events we have to insert the view inside the first view of the second window
    35     // in order to get rotation events we have to insert the view inside the first view of the second window
    36     [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view];
    36     [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view];
    37 
    37 
    55     [overlay_instance.loadingIndicator startAnimating];
    55     [overlay_instance.loadingIndicator startAnimating];
    56     [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
    56     [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
    57     [overlay_instance.loadingIndicator release];
    57     [overlay_instance.loadingIndicator release];
    58 }
    58 }
    59 
    59 
    60 void stopLoadingIndicator() {
    60 void stopLoadingIndicator(void) {
    61     HW_zoomSet(1.7);
    61     HW_zoomSet(1.7);
    62     if ([HWUtils gameType] != gtSave) {
    62     if ([HWUtils gameType] != gtSave) {
    63         [overlay_instance.loadingIndicator stopAnimating];
    63         [overlay_instance.loadingIndicator stopAnimating];
    64         [overlay_instance.loadingIndicator removeFromSuperview];
    64         [overlay_instance.loadingIndicator removeFromSuperview];
    65         [HWUtils setGameStatus:gsInGame];
    65         [HWUtils setGameStatus:gsInGame];
    67     // mark the savefile as valid, eg it's been loaded correctly
    67     // mark the savefile as valid, eg it's been loaded correctly
    68     [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"saveIsValid"];
    68     [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"saveIsValid"];
    69     [[NSUserDefaults standardUserDefaults] synchronize];
    69     [[NSUserDefaults standardUserDefaults] synchronize];
    70 }
    70 }
    71 
    71 
    72 void saveFinishedSynching() {
    72 void saveFinishedSynching(void) {
    73     [UIView beginAnimations:@"fading from save synch" context:NULL];
    73     [UIView beginAnimations:@"fading from save synch" context:NULL];
    74     [UIView setAnimationDuration:1];
    74     [UIView setAnimationDuration:1];
    75     overlay_instance.view.backgroundColor = [UIColor clearColor];
    75     overlay_instance.view.backgroundColor = [UIColor clearColor];
    76     overlay_instance.view.alpha = 1;
    76     overlay_instance.view.alpha = 1;
    77     overlay_instance.view.userInteractionEnabled = YES;
    77     overlay_instance.view.userInteractionEnabled = YES;
    82 
    82 
    83     [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    83     [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    84     [HWUtils setGameStatus:gsInGame];
    84     [HWUtils setGameStatus:gsInGame];
    85 }
    85 }
    86 
    86 
    87 void clearView() {
    87 void clearView(void) {
    88     [overlay_instance clearOverlay];
    88     [overlay_instance clearOverlay];
    89 }
    89 }
    90 
    90 
    91 // dummy function to prevent linkage fail
    91 // dummy function to prevent linkage fail
    92 int SDL_main(int argc, char **argv) {
    92 int SDL_main(int argc, char **argv) {