project_files/HedgewarsMobile/Classes/GameSetup.m
changeset 3948 24daa33a3114
parent 3941 017b2b31e1c6
child 3976 abaf741a4e21
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Sun Oct 10 21:32:18 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Sun Oct 10 22:32:01 2010 +0200
@@ -35,19 +35,24 @@
     if (self = [super init]) {
         ipcPort = randomPort();
 
-        // should check they exist and throw and exection if not
+        // the general settings file + menu style (read by the overlay)
         NSDictionary *dictSett = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()];
+        self.menuStyle = [[dictSett objectForKey:@"menu"] boolValue];
         self.systemSettings = dictSett;
-        self.menuStyle = [[dictSett objectForKey:@"menu"] boolValue];
         [dictSett release];
 
+        // this game run settings
         self.gameConfig = [gameDictionary objectForKey:@"game_dictionary"];
+
+        // is it a netgame?
         isNetGame = [[gameDictionary objectForKey:@"netgame"] boolValue];
+
+        // is it a Save?
         NSString *path = [gameDictionary objectForKey:@"savefile"];
-        // if path is empty it means i have to create a new file, otherwise i read from that file
+        // if path is empty it means that you have to create a new file, otherwise read from that file
         if ([path isEqualToString:@""] == YES) {
             NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
-            [outputFormatter setDateFormat:@"yyyy-MM-dd 'at' HH,mm"];
+            [outputFormatter setDateFormat:@"yyyy.MM.dd '@' HH-mm"];
             NSString *newDateString = [outputFormatter stringFromDate:[NSDate date]];
             self.savePath = [SAVES_DIRECTORY() stringByAppendingFormat:@"%@.hws", newDateString];
             [outputFormatter release];
@@ -451,7 +456,12 @@
         CGRect screenBounds = [[UIScreen mainScreen] bounds];
         width = (int) screenBounds.size.height;
         height = (int) screenBounds.size.width;
-        rotation = @"-90";
+        UIDeviceOrientation orientation = (UIDeviceOrientation) [[self.gameConfig objectForKey:@"orientation"] intValue];
+        if (orientation == UIDeviceOrientationLandscapeLeft)
+            rotation = @"-90";
+        else
+            rotation = @"90";
+
     }
         
     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width];