project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 7048 0a4c88935902
parent 6908 896ed2afcfb8
child 10108 c68cf030eded
equal deleted inserted replaced
7047:606acf1f80be 7048:0a4c88935902
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    17  */
    17  */
    18 
    18 
    19 
    19 
    20 #import "ObjcExports.h"
    20 #import "ObjcExports.h"
    21 #import "OverlayViewController.h"
       
    22 
       
    23 // the reference to the newMenu instance
       
    24 static OverlayViewController *overlay_instance;
       
    25 
    21 
    26 #pragma mark -
    22 #pragma mark -
    27 #pragma mark functions called by pascal code
    23 #pragma mark functions called by pascal code
    28 BOOL inline isApplePhone(void) {
    24 BOOL inline isApplePhone(void) {
    29     return (IS_IPAD() == NO);
    25     return (IS_IPAD() == NO);
    30 }
    26 }
    31 
    27 
    32 void startLoadingIndicator(void) {
    28 void startLoadingIndicator(void) {
    33     // this is the first ojbc function called by engine, so we have to initialize some variables here
    29     // 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];
       
    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];
       
    37 
    30 
    38     if ([HWUtils gameType] == gtSave) {
    31     if ([HWUtils gameType] == gtSave) {
    39         [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    32         [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    40 
    33 
       
    34         /*
    41         overlay_instance.view.backgroundColor = [UIColor blackColor];
    35         overlay_instance.view.backgroundColor = [UIColor blackColor];
    42         overlay_instance.view.alpha = 0.75;
    36         overlay_instance.view.alpha = 0.75;
    43         overlay_instance.view.userInteractionEnabled = NO;
    37         overlay_instance.view.userInteractionEnabled = NO;
       
    38         */
    44     }
    39     }
       
    40     /*
    45     CGPoint center = overlay_instance.view.center;
    41     CGPoint center = overlay_instance.view.center;
    46     CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3);
    42     CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3);
    47 
    43 
    48     overlay_instance.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    44     overlay_instance.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    49     overlay_instance.loadingIndicator.hidesWhenStopped = YES;
    45     overlay_instance.loadingIndicator.hidesWhenStopped = YES;
    53                                                          UIViewAutoresizingFlexibleTopMargin |
    49                                                          UIViewAutoresizingFlexibleTopMargin |
    54                                                          UIViewAutoresizingFlexibleBottomMargin;
    50                                                          UIViewAutoresizingFlexibleBottomMargin;
    55     [overlay_instance.loadingIndicator startAnimating];
    51     [overlay_instance.loadingIndicator startAnimating];
    56     [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
    52     [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
    57     [overlay_instance.loadingIndicator release];
    53     [overlay_instance.loadingIndicator release];
       
    54     */
    58 }
    55 }
    59 
    56 
    60 void stopLoadingIndicator(void) {
    57 void stopLoadingIndicator(void) {
    61     HW_zoomSet(1.7);
    58     //HW_zoomSet(1.7);
    62     if ([HWUtils gameType] != gtSave) {
    59     if ([HWUtils gameType] != gtSave) {
    63         [overlay_instance.loadingIndicator stopAnimating];
    60         //[overlay_instance.loadingIndicator stopAnimating];
    64         [overlay_instance.loadingIndicator removeFromSuperview];
    61         //[overlay_instance.loadingIndicator removeFromSuperview];
    65         [HWUtils setGameStatus:gsInGame];
    62         [HWUtils setGameStatus:gsInGame];
    66     }
    63     }
    67     // mark the savefile as valid, eg it's been loaded correctly
    64     // mark the savefile as valid, eg it's been loaded correctly
    68     [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"saveIsValid"];
    65     [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"saveIsValid"];
    69     [[NSUserDefaults standardUserDefaults] synchronize];
    66     [[NSUserDefaults standardUserDefaults] synchronize];
    70 }
    67 }
    71 
    68 
    72 void saveFinishedSynching(void) {
    69 void saveFinishedSynching(void) {
       
    70     /*
    73     [UIView beginAnimations:@"fading from save synch" context:NULL];
    71     [UIView beginAnimations:@"fading from save synch" context:NULL];
    74     [UIView setAnimationDuration:1];
    72     [UIView setAnimationDuration:1];
    75     overlay_instance.view.backgroundColor = [UIColor clearColor];
    73     overlay_instance.view.backgroundColor = [UIColor clearColor];
    76     overlay_instance.view.alpha = 1;
    74     overlay_instance.view.alpha = 1;
    77     overlay_instance.view.userInteractionEnabled = YES;
    75     overlay_instance.view.userInteractionEnabled = YES;
    78     [UIView commitAnimations];
    76     [UIView commitAnimations];
    79 
    77 
    80     [overlay_instance.loadingIndicator stopAnimating];
    78     [overlay_instance.loadingIndicator stopAnimating];
    81     [overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
    79     [overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
       
    80     */
    82 
    81 
    83     [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    82     [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    84     [HWUtils setGameStatus:gsInGame];
    83     [HWUtils setGameStatus:gsInGame];
    85 }
    84 }
    86 
    85 
    87 void clearView(void) {
       
    88     [overlay_instance clearOverlay];
       
    89 }
       
    90 
    86 
    91 // dummy function to prevent linkage fail
    87 // dummy function to prevent linkage fail
    92 int SDL_main(int argc, char **argv) {
    88 int SDL_main(int argc, char **argv) {
    93     return 0;
    89     return 0;
    94 }
    90 }