2
* Hedgewars-iOS, a Hedgewars port for iOS devices
3
* Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
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
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.
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.
20
#import "ObjcExports.h"
23
#pragma mark functions called by pascal code
24
BOOL inline isApplePhone(void) {
25
return (IS_IPAD() == NO);
28
void startLoadingIndicator(void) {
29
// this is the first ojbc function called by engine, so we have to initialize some variables here
31
if ([HWUtils gameType] == gtSave) {
32
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
35
overlay_instance.view.backgroundColor = [UIColor blackColor];
36
overlay_instance.view.alpha = 0.75;
37
overlay_instance.view.userInteractionEnabled = NO;
41
CGPoint center = overlay_instance.view.center;
42
CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3);
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];
57
void stopLoadingIndicator(void) {
59
if ([HWUtils gameType] != gtSave) {
60
//[overlay_instance.loadingIndicator stopAnimating];
61
//[overlay_instance.loadingIndicator removeFromSuperview];
62
[HWUtils setGameStatus:gsInGame];
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];
69
void saveFinishedSynching(void) {
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];
78
[overlay_instance.loadingIndicator stopAnimating];
79
[overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
82
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
83
[HWUtils setGameStatus:gsInGame];
87
// dummy function to prevent linkage fail
88
int SDL_main(int argc, char **argv) {