project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 5175 a3da220dbb3f
parent 5174 f5294509783e
child 5194 851c6fbb44e6
equal deleted inserted replaced
5174:f5294509783e 5175:a3da220dbb3f
    31 BOOL savedGame;
    31 BOOL savedGame;
    32 // cache the grenade time
    32 // cache the grenade time
    33 NSInteger grenadeTime;
    33 NSInteger grenadeTime;
    34 // the reference to the newMenu instance
    34 // the reference to the newMenu instance
    35 OverlayViewController *overlay_instance;
    35 OverlayViewController *overlay_instance;
    36 // the audiosession must be initialized before using properties
    36 
    37 BOOL gAudioSessionInited = NO;
       
    38 
    37 
    39 #pragma mark -
    38 #pragma mark -
    40 #pragma mark functions called like oop
    39 #pragma mark functions called like oop
    41 void objcExportsInit(OverlayViewController* instance) {
    40 void objcExportsInit(OverlayViewController* instance) {
    42     overlay_instance = instance;
    41     overlay_instance = instance;
    84         gameRunning = YES;
    83         gameRunning = YES;
    85 }
    84 }
    86 
    85 
    87 void clearView() {
    86 void clearView() {
    88     // don't use any engine calls here as this function is called every time the ammomenu is opened
    87     // don't use any engine calls here as this function is called every time the ammomenu is opened
    89     UIWindow *theWindow = (IS_DUALHEAD()) ? [HedgewarsAppDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow];
       
    90     UIButton *theButton = (UIButton *)[theWindow viewWithTag:CONFIRMATION_TAG];
       
    91     UISegmentedControl *theSegment = (UISegmentedControl *)[theWindow viewWithTag:GRENADE_TAG];
       
    92 
       
    93     [UIView beginAnimations:@"remove button" context:NULL];
    88     [UIView beginAnimations:@"remove button" context:NULL];
    94     [UIView setAnimationDuration:ANIMATION_DURATION];
    89     [UIView setAnimationDuration:ANIMATION_DURATION];
    95     theButton.alpha = 0;
    90     overlay_instance.confirmButton.alpha = 0;
    96     theSegment.alpha = 0;
    91     overlay_instance.grenadeTimeSegment.alpha = 0;
    97     [UIView commitAnimations];
    92     [UIView commitAnimations];
    98 
    93 
    99     if (theButton)
    94     if (overlay_instance.confirmButton)
   100         [theWindow performSelector:@selector(removeFromSuperview) withObject:theButton afterDelay:ANIMATION_DURATION];
    95         [overlay_instance.confirmButton performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:ANIMATION_DURATION];
   101     if (theSegment)
    96     if (overlay_instance.grenadeTimeSegment) {
   102         [theWindow performSelector:@selector(removeFromSuperview) withObject:theSegment afterDelay:ANIMATION_DURATION];
    97         [overlay_instance.grenadeTimeSegment performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:ANIMATION_DURATION];
   103 
    98         overlay_instance.grenadeTimeSegment.tag = 0;
       
    99     }
   104     grenadeTime = 2;
   100     grenadeTime = 2;
   105 }
   101 }
   106 
   102 
   107 void saveBeganSynching() {
   103 void saveBeganSynching() {
   108     overlay_instance.view.backgroundColor = [UIColor blackColor];
   104     overlay_instance.view.backgroundColor = [UIColor blackColor];