playing a bit with colors
authorkoda
Thu, 30 Sep 2010 01:34:12 +0200
changeset 3917 4c243b1eac97
parent 3916 e7d665a4ef42
child 3918 916ed485daed
playing a bit with colors
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/CommodityFunctions.m
project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
project_files/HedgewarsMobile/Classes/SquareButtonView.m
project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Wed Sep 29 23:50:46 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Thu Sep 30 01:34:12 2010 +0200
@@ -63,3 +63,4 @@
 BOOL isPhone ();
 NSInteger randomPort ();
 NSString *modelType ();
+NSArray *getAvailableColors(void);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Wed Sep 29 23:50:46 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Thu Sep 30 01:34:12 2010 +0200
@@ -262,4 +262,16 @@
 
     //Use audio services to play the sound
     AudioServicesPlaySystemSound(soundID);
-}
\ No newline at end of file
+}
+
+NSArray *getAvailableColors(void) {
+    return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:0x4376e9],     // bluette
+                                     [NSNumber numberWithUnsignedInt:0x3e9321],     // greeeen
+                                     [NSNumber numberWithUnsignedInt:0xa23dbb],     // violett
+                                     [NSNumber numberWithUnsignedInt:0xff9329],     // oranngy
+                                     [NSNumber numberWithUnsignedInt:0xdd0000],     // reddish
+                                     [NSNumber numberWithUnsignedInt:0x737373],     // graaaay
+                                     [NSNumber numberWithUnsignedInt:0xbba23d],     // gold$$$
+                                     [NSNumber numberWithUnsignedInt:0x3da2bb],     // cyannnn  
+                                     nil];
+}
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Wed Sep 29 23:50:46 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Thu Sep 30 01:34:12 2010 +0200
@@ -41,11 +41,9 @@
     self.selectedScheme = @"";
     self.selectedWeapon = @"";
 
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-        [self.tableView setBackgroundView:nil];
-        self.view.backgroundColor = [UIColor clearColor];
-        self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
-    }
+    [self.tableView setBackgroundView:nil];
+    self.view.backgroundColor = [UIColor clearColor];
+    self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
 }
 
--- a/project_files/HedgewarsMobile/Classes/SquareButtonView.m	Wed Sep 29 23:50:46 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SquareButtonView.m	Thu Sep 30 01:34:12 2010 +0200
@@ -32,16 +32,7 @@
         colorIndex = -1;
         selectedColor = 0;
 
-        // list of allowed colors
-        NSArray *colors = [[NSArray alloc] initWithObjects: [NSNumber numberWithUnsignedInt:4421353],    // bluette
-                                                            [NSNumber numberWithUnsignedInt:4100897],    // greeeen
-                                                            [NSNumber numberWithUnsignedInt:10632635],   // violett
-                                                            [NSNumber numberWithUnsignedInt:16749353],   // oranngy
-                                                            [NSNumber numberWithUnsignedInt:14483456],   // reddish
-                                                            [NSNumber numberWithUnsignedInt:7566195],    // graaaay
-                                                            nil];
-        self.colorArray = colors;
-        [colors release];
+        self.colorArray = getAvailableColors();
 
         // set the color to the first available one
         [self nextColor];
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m	Wed Sep 29 23:50:46 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m	Thu Sep 30 01:34:12 2010 +0200
@@ -40,11 +40,9 @@
     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
     
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-        [self.tableView setBackgroundView:nil];
-        self.view.backgroundColor = [UIColor clearColor];
-        self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
-    }
+    [self.tableView setBackgroundView:nil];
+    self.view.backgroundColor = [UIColor clearColor];
+    self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
 }
 
@@ -54,14 +52,13 @@
     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
     // avoid overwriting selected teams when returning on this view
     if ([cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
-        // integer representation of various color (defined in SquareButtonView)
-        NSUInteger colors[6] = { 4421353, 4100897, 10632635, 16749353, 14483456, 7566195 };
+        NSArray *colors = getAvailableColors();
         NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
         for (int i = 0; i < [contentsOfDir count]; i++) {
             NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                                          [contentsOfDir objectAtIndex:i],@"team",
                                          [NSNumber numberWithInt:4],@"number",
-                                         [NSNumber numberWithInt:colors[i%6]],@"color",nil];
+                                         [colors objectAtIndex:i%[colors count]],@"color",nil];
             [array addObject:dict];
             [dict release];
         }
@@ -163,11 +160,9 @@
         cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension];
         cell.accessoryView = nil;
     }
-
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-        cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
-        cell.backgroundColor = [UIColor blackColor];
-    }
+    
+    cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
+    cell.backgroundColor = [UIColor blackColor];
     
     return cell;
 }
@@ -200,15 +195,6 @@
     return theView;
 }
 
-/*
--(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
-    if (section == 0)
-        return NSLocalizedString(@"Playing Teams",@"");
-    else
-        return NSLocalizedString(@"Available Teams",@"");
-}
-*/
-
 #pragma mark -
 #pragma mark Table view delegate
 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {