author | Medo <smaxein@googlemail.com> |
Sun, 16 Sep 2012 17:42:48 +0200 | |
changeset 7689 | 855eeee4166f |
parent 6869 | a187c280dd3d |
child 10108 | c68cf030eded |
permissions | -rw-r--r-- |
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
1 |
/* |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
6700 | 3 |
* Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com> |
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
4 |
* |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
8 |
* |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
13 |
* |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
17 |
*/ |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
18 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
19 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
20 |
#import "RestoreViewController.h" |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
21 |
#import "GameInterfaceBridge.h" |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
22 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
23 |
@implementation RestoreViewController |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
24 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
25 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
26 |
return rotationManager(interfaceOrientation); |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
27 |
} |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
28 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
29 |
-(IBAction) buttonReleased:(id) sender { |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
30 |
UIButton *theButton = (UIButton *)sender; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
31 |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
32 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
33 |
if (theButton.tag != 0) { |
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
34 |
[[AudioManagerController mainManager] playClickSound]; |
6353
d8f62c805619
restore displaying statistics at the end of a game and restore warning lower views that they are going to appear
koda
parents:
6321
diff
changeset
|
35 |
[GameInterfaceBridge registerCallingController:self.parentViewController]; |
d8f62c805619
restore displaying statistics at the end of a game and restore warning lower views that they are going to appear
koda
parents:
6321
diff
changeset
|
36 |
[GameInterfaceBridge startSaveGame:[[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"]]; |
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
37 |
} else { |
6869
a187c280dd3d
ios: convert audio operation from class to instance, plays better with memory
koda
parents:
6832
diff
changeset
|
38 |
[[AudioManagerController mainManager] playBackSound]; |
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
39 |
[defaults setObject:@"" forKey:@"savedGamePath"]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
40 |
[defaults synchronize]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
41 |
} |
6321 | 42 |
[self.parentViewController dismissModalViewControllerAnimated:YES]; |
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
43 |
} |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
44 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
45 |
-(void) viewDidLoad { |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
46 |
[super viewDidLoad]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
47 |
} |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
48 |
|
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5220
diff
changeset
|
49 |
-(void) didReceiveMemoryWarning { |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5220
diff
changeset
|
50 |
[super didReceiveMemoryWarning]; |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5220
diff
changeset
|
51 |
} |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5220
diff
changeset
|
52 |
|
5220
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
53 |
-(void) viewDidUnload { |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
54 |
[super viewDidUnload]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
55 |
} |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
56 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
57 |
-(void) dealloc { |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
58 |
[super dealloc]; |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
59 |
} |
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
60 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
61 |
|
76a2246f18f0
when the match is not completed (eg out of memory or crash) the game asks for restoring it as soon as it is opened again
koda
parents:
diff
changeset
|
62 |
@end |