~ubuntu-branches/ubuntu/raring/hedgewars/raring-backports

« back to all changes in this revision

Viewing changes to project_files/HedgewarsMobile/Classes/ObjcExports.m

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-06-21 17:55:04 UTC
  • mfrom: (19.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20130621175504-otv451gi461tj4bn
Tags: 0.9.19.3-1~ubuntu13.04.1
No-change backport to raring (LP: #1191816)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
 
3
 * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; version 2 of the License
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
 
 
20
#import "ObjcExports.h"
 
21
 
 
22
#pragma mark -
 
23
#pragma mark functions called by pascal code
 
24
BOOL inline isApplePhone(void) {
 
25
    return (IS_IPAD() == NO);
 
26
}
 
27
 
 
28
void startLoadingIndicator(void) {
 
29
    // this is the first ojbc function called by engine, so we have to initialize some variables here
 
30
 
 
31
    if ([HWUtils gameType] == gtSave) {
 
32
        [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
 
33
 
 
34
        /*
 
35
        overlay_instance.view.backgroundColor = [UIColor blackColor];
 
36
        overlay_instance.view.alpha = 0.75;
 
37
        overlay_instance.view.userInteractionEnabled = NO;
 
38
        */
 
39
    }
 
40
    /*
 
41
    CGPoint center = overlay_instance.view.center;
 
42
    CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3);
 
43
 
 
44
    overlay_instance.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
 
45
    overlay_instance.loadingIndicator.hidesWhenStopped = YES;
 
46
    overlay_instance.loadingIndicator.center = loaderCenter;
 
47
    overlay_instance.loadingIndicator.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
 
48
                                                         UIViewAutoresizingFlexibleRightMargin |
 
49
                                                         UIViewAutoresizingFlexibleTopMargin |
 
50
                                                         UIViewAutoresizingFlexibleBottomMargin;
 
51
    [overlay_instance.loadingIndicator startAnimating];
 
52
    [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
 
53
    [overlay_instance.loadingIndicator release];
 
54
    */
 
55
}
 
56
 
 
57
void stopLoadingIndicator(void) {
 
58
    //HW_zoomSet(1.7);
 
59
    if ([HWUtils gameType] != gtSave) {
 
60
        //[overlay_instance.loadingIndicator stopAnimating];
 
61
        //[overlay_instance.loadingIndicator removeFromSuperview];
 
62
        [HWUtils setGameStatus:gsInGame];
 
63
    }
 
64
    // mark the savefile as valid, eg it's been loaded correctly
 
65
    [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"saveIsValid"];
 
66
    [[NSUserDefaults standardUserDefaults] synchronize];
 
67
}
 
68
 
 
69
void saveFinishedSynching(void) {
 
70
    /*
 
71
    [UIView beginAnimations:@"fading from save synch" context:NULL];
 
72
    [UIView setAnimationDuration:1];
 
73
    overlay_instance.view.backgroundColor = [UIColor clearColor];
 
74
    overlay_instance.view.alpha = 1;
 
75
    overlay_instance.view.userInteractionEnabled = YES;
 
76
    [UIView commitAnimations];
 
77
 
 
78
    [overlay_instance.loadingIndicator stopAnimating];
 
79
    [overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
 
80
    */
 
81
 
 
82
    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
 
83
    [HWUtils setGameStatus:gsInGame];
 
84
}
 
85
 
 
86
 
 
87
// dummy function to prevent linkage fail
 
88
int SDL_main(int argc, char **argv) {
 
89
    return 0;
 
90
}