project_files/HedgewarsMobile/Classes/RestoreViewController.m
changeset 5220 76a2246f18f0
child 5666 cc79eb30346e
equal deleted inserted replaced
5219:9e2a17ab178b 5220:76a2246f18f0
       
     1 /*
       
     2  * Hedgewars-iOS, a Hedgewars port for iOS devices
       
     3  * Copyright (c) 2009-2011 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  * File created on 28/05/2011.
       
    19  */
       
    20 
       
    21 
       
    22 #import "RestoreViewController.h"
       
    23 #import "GameInterfaceBridge.h"
       
    24 
       
    25 @implementation RestoreViewController
       
    26 
       
    27 
       
    28 // Override to allow orientations other than the default portrait orientation.
       
    29 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
       
    30     return rotationManager(interfaceOrientation);
       
    31 }
       
    32 
       
    33 
       
    34 -(IBAction) buttonReleased:(id) sender {
       
    35     UIButton *theButton = (UIButton *)sender;
       
    36     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
       
    37 
       
    38     if (theButton.tag != 0) {
       
    39         GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self.parentViewController];
       
    40         [self.parentViewController dismissModalViewControllerAnimated:NO];
       
    41         [bridge startSaveGame:[defaults objectForKey:@"savedGamePath"]];
       
    42         [bridge release];
       
    43     } else {
       
    44         [defaults setObject:@"" forKey:@"savedGamePath"];
       
    45         [defaults synchronize];
       
    46         [self.parentViewController dismissModalViewControllerAnimated:YES];
       
    47     }
       
    48 }
       
    49 
       
    50 -(void) didReceiveMemoryWarning {
       
    51     [super didReceiveMemoryWarning];
       
    52 }
       
    53 
       
    54 -(void) viewDidLoad {
       
    55     NSString *imgName;
       
    56     if (IS_IPAD())
       
    57         imgName = @"smallerBackground~ipad.png";
       
    58     else
       
    59         imgName = @"smallerBackground~iphone.png";
       
    60     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
       
    61     self.view.backgroundColor = [UIColor colorWithPatternImage:img];
       
    62     [img release];
       
    63     [super viewDidLoad];
       
    64 }
       
    65 
       
    66 -(void) viewDidUnload {
       
    67     [super viewDidUnload];
       
    68 }
       
    69 
       
    70 -(void) dealloc {
       
    71     [super dealloc];
       
    72 }
       
    73 
       
    74 
       
    75 @end