# HG changeset patch # User koda # Date 1291816072 -3600 # Node ID 4bf74e158f44d6fd5348653c673515b8748f675f # Parent 499748f6e80f1b651480dc8c378f0b06d00962d7 team selection completely refactored, now has animation and more performance use a semi transparent black background color (on powerful devices) other smaller improvements and bugfixes diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/CGPointUtils.c --- a/project_files/HedgewarsMobile/Classes/CGPointUtils.c Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/CGPointUtils.c Wed Dec 08 14:47:52 2010 +0100 @@ -32,3 +32,29 @@ CGFloat rads = acos(((a*c) + (b*d)) / ((sqrt(a*a + b*b)) * (sqrt(c*c + d*d)))); return radiansToDegrees(rads); } + +CGFloat CGPointDot(CGPoint a,CGPoint b) { + return a.x*b.x+a.y*b.y; +} + +CGFloat CGPointLen(CGPoint a) { + return sqrtf(a.x*a.x+a.y*a.y); +} + +CGPoint CGPointSub(CGPoint a,CGPoint b) { + CGPoint c = {a.x-b.x,a.y-b.y}; + return c; +} + +CGFloat CGPointDist(CGPoint a,CGPoint b) { + CGPoint c = CGPointSub(a,b); + return CGPointLen(c); +} + +CGPoint CGPointNorm(CGPoint a) { + CGFloat m = sqrtf(a.x*a.x+a.y*a.y); + CGPoint c; + c.x = a.x/m; + c.y = a.y/m; + return c; +} diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/CGPointUtils.h --- a/project_files/HedgewarsMobile/Classes/CGPointUtils.h Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/CGPointUtils.h Wed Dec 08 14:47:52 2010 +0100 @@ -21,3 +21,9 @@ CGFloat distanceBetweenPoints (CGPoint first, CGPoint second); CGFloat angleBetweenPoints(CGPoint first, CGPoint second); CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End); + +CGFloat CGPointDot(CGPoint a, CGPoint b); +CGFloat CGPointLen(CGPoint a); +CGPoint CGPointSub(CGPoint a, CGPoint b); +CGFloat CGPointDist(CGPoint a, CGPoint b); +CGPoint CGPointNorm(CGPoint a); diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/CommodityFunctions.h --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Wed Dec 08 14:47:52 2010 +0100 @@ -25,6 +25,7 @@ #define SETTINGS_FILE() [DOCUMENTS_FOLDER() stringByAppendingString:@"/settings.plist"] #define DEBUG_FILE() [DOCUMENTS_FOLDER() stringByAppendingString:@"/hw-game.log"] +#define HEDGEHOG_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Settings/Images/hedgehog.png"] #define TEAMS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Teams/"] #define WEAPONS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Weapons/"] @@ -52,6 +53,7 @@ #define UICOLOR_HW_YELLOW_TEXT [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1] #define UICOLOR_HW_DARKBLUE [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1] #define UICOLOR_HW_ALPHABLUE [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:0.58f] +#define UICOLOR_HW_ALMOSTBLACK (IS_NOT_POWERFUL()) ? [UIColor blackColor] : [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6] #define IS_DUALHEAD() ([[UIScreen class] respondsToSelector:@selector(screens)] && [[UIScreen screens] count] > 1) #define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/FortsViewController.m --- a/project_files/HedgewarsMobile/Classes/FortsViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/FortsViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -23,6 +23,8 @@ #import "CommodityFunctions.h" #import "UIImageExtra.h" +#define IMGNUM_PER_FORT 4 + @implementation FortsViewController @synthesize teamDictionary, fortArray, lastIndexPath; @@ -41,7 +43,7 @@ NSMutableArray *filteredContents = [[NSMutableArray alloc] initWithCapacity:([directoryContents count] / 3)]; // we need to remove the double entries and the L.png suffix for (int i = 0; i < [directoryContents count]; i++) { - if (i % 3 == 1) { + if (i % IMGNUM_PER_FORT == 3) { NSString *currentName = [directoryContents objectAtIndex:i]; NSString *correctName = [currentName substringToIndex:([currentName length] - 5)]; [filteredContents addObject:correctName]; @@ -51,13 +53,13 @@ [filteredContents release]; // statically set row height instead of using delegate method for performance reasons - self.tableView.rowHeight = 200; + self.tableView.rowHeight = 128; self.title = NSLocalizedString(@"Choose team fort",@""); } -- (void)viewWillAppear:(BOOL)animated { +-(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.tableView reloadData]; [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; @@ -79,10 +81,9 @@ static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { + if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; - } NSString *fortName = [fortArray objectAtIndex:[indexPath row]]; cell.textLabel.text = fortName; @@ -151,7 +152,6 @@ [teamDictionary release]; [lastIndexPath release]; [fortArray release]; -// [fortSprites release]; [super dealloc]; } diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/HogButtonView.h --- a/project_files/HedgewarsMobile/Classes/HogButtonView.h Tue Dec 07 01:18:43 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2010 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 20/04/2010. - */ - - -#import - - -@interface HogButtonView : UIButton { - NSInteger numberOfHogs; - UIImage *singleHog; - NSMutableDictionary *ownerDictionary; -} - -@property (nonatomic,retain) UIImage *singleHog; -@property (nonatomic) NSInteger numberOfHogs; -@property (nonatomic,retain) NSMutableDictionary *ownerDictionary; - --(void) drawManyHogs:(NSInteger) hogs; --(void) addOne; - -@end diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/HogButtonView.m --- a/project_files/HedgewarsMobile/Classes/HogButtonView.m Tue Dec 07 01:18:43 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2010 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 20/04/2010. - */ - - -#import "HogButtonView.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "PascalImports.h" - -@implementation HogButtonView -@synthesize singleHog, numberOfHogs, ownerDictionary; - --(id) initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { - self.backgroundColor = [UIColor clearColor]; - - NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; - UIImage *normalHogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; - [normalHogFile release]; - - self.singleHog = normalHogSprite; - [normalHogSprite release]; - [self addTarget:self action:@selector(addOne) forControlEvents:UIControlEventTouchUpInside]; - } - return self; -} - --(void) addOne { - playSound(@"clickSound"); - self.highlighted = NO; - NSInteger number = self.numberOfHogs; - number++; - [self drawManyHogs:number]; -} - --(void) drawManyHogs:(NSInteger) hogs { - if (numberOfHogs != hogs) { - if (hogs <= HW_getMaxNumberOfHogs() && hogs >= 1) - numberOfHogs = hogs; - else { - if (hogs > HW_getMaxNumberOfHogs()) - numberOfHogs = 1; - else - numberOfHogs = HW_getMaxNumberOfHogs(); - } - [ownerDictionary setObject:[NSNumber numberWithInt:numberOfHogs] forKey:@"number"]; - - UIImage *teamHogs = [[[UIImage alloc] init] autorelease]; - for (int i = 0; i < numberOfHogs; i++) { - teamHogs = [singleHog mergeWith:teamHogs - atPoint:CGPointMake(8, 0) - ofSize:CGSizeMake(88, 32)]; - } - [self setImage:teamHogs forState:UIControlStateNormal]; - } -} - --(void) dealloc { - [ownerDictionary release]; - [singleHog release]; - [super dealloc]; -} - - -@end diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/HoldTableViewCell.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Wed Dec 08 14:47:52 2010 +0100 @@ -0,0 +1,38 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 03/07/2010. + */ + + +#import + +@protocol HoldTableViewCellDelegate + +-(void) holdAction:(NSString *)content; + +@end + +@interface HoldTableViewCell : UITableViewCell { + id delegate; +} + +@property (nonatomic,assign) id delegate; + +-(void) holdAction; + +@end diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/HoldTableViewCell.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Wed Dec 08 14:47:52 2010 +0100 @@ -0,0 +1,64 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 03/07/2010. + */ + +//http://devblog.wm-innovations.com/2010/03/30/custom-swipe-uitableviewcell/ + + +#import "HoldTableViewCell.h" +#import "CGPointUtils.h" + +@implementation HoldTableViewCell +@synthesize delegate; + +#define SWIPE_DRAG_HORIZ_MIN 10 +#define SWIPE_DRAG_VERT_MAX 40 + +-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { + delegate = nil; + } + return self; +} + +-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self performSelector:@selector(holdAction) withObject:nil afterDelay:0.4]; + + [super touchesBegan:touches withEvent:event]; +} + +-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + [NSObject cancelPreviousPerformRequestsWithTarget:self + selector:@selector(holdAction) + object:nil]; + + [super touchesEnded:touches withEvent:event]; +} + +-(void) holdAction { + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:)]) + [self.delegate holdAction:self.textLabel.text]; +} + +-(void) dealloc { + self.delegate = nil; + [super dealloc]; +} + +@end diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/LevelViewController.m --- a/project_files/HedgewarsMobile/Classes/LevelViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -177,7 +177,6 @@ self.lastIndexPath = indexPath; [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; } - [self.navigationController popViewControllerAnimated:YES]; } [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; } diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -139,6 +139,7 @@ cell.textLabel.adjustsFontSizeToFitWidth = YES; cell.textLabel.minimumFontSize = 7; cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + cell.textLabel.backgroundColor = [UIColor clearColor]; if (isRandomness()) { UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]]; @@ -154,7 +155,7 @@ } else cell.accessoryView = nil; - cell.backgroundColor = [UIColor blackColor]; + cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; return cell; } diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -174,7 +174,7 @@ label.font = [UIFont systemFontOfSize:16]; label.textColor = [UIColor lightGrayColor]; label.numberOfLines = 5; - label.text = NSLocalizedString(@"Games are automatically saved and can be resumed by selecting an entry above.\nYou can modify this list by pressing the 'Edit' button.\nNotice that completed games are deleted, so make backups.",@""); + label.text = NSLocalizedString(@"Games are automatically saved and can be resumed by selecting an entry above.\nYou can modify this list by pressing the 'Edit' button.\nCompleted games are removed at the end of the match.",@""); label.backgroundColor = [UIColor clearColor]; [footer addSubview:label]; diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -146,7 +146,7 @@ cell.accessoryView = self.syncSwitch; } - cell.backgroundColor = [UIColor blackColor]; + cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; cell.detailTextLabel.textColor = [UIColor whiteColor]; return cell; diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/TeamConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Wed Dec 08 14:47:52 2010 +0100 @@ -20,11 +20,14 @@ #import - +#import "HoldTableViewCell.h" -@interface TeamConfigViewController : UITableViewController { +@interface TeamConfigViewController : UITableViewController { + NSInteger selectedTeamsCount; + NSInteger allTeamsCount; + + NSMutableArray *listOfSelectedTeams; NSMutableArray *listOfTeams; - NSMutableArray *listOfSelectedTeams; NSArray *cachedContentsOfDir; } diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/TeamConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Wed Dec 08 14:47:52 2010 +0100 @@ -21,16 +21,11 @@ #import "TeamConfigViewController.h" #import "CommodityFunctions.h" -#import "HogButtonView.h" #import "SquareButtonView.h" @implementation TeamConfigViewController @synthesize listOfTeams, listOfSelectedTeams, cachedContentsOfDir; -#define NUMBERBUTTON_TAG 123456 -#define SQUAREBUTTON_TAG 654321 -#define LABEL_TAG 456123 - #pragma mark - #pragma mark View lifecycle -(void) viewDidLoad { @@ -49,9 +44,8 @@ [self.tableView setBackgroundView:background]; [background release]; } - } else { + } else self.view.backgroundColor = [UIColor blackColor]; - } self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; @@ -79,8 +73,11 @@ NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil]; self.listOfSelectedTeams = emptyArray; [emptyArray release]; - - cachedContentsOfDir = [[NSArray alloc] initWithArray:contentsOfDir copyItems:YES]; + + selectedTeamsCount = [self.listOfSelectedTeams count]; + allTeamsCount = [self.listOfTeams count]; + + self.cachedContentsOfDir = [[NSArray alloc] initWithArray:contentsOfDir copyItems:YES]; } [self.tableView reloadData]; } @@ -89,6 +86,49 @@ return rotationManager(interfaceOrientation); } +-(NSInteger) filterNumberOfHogs:(NSInteger) hogs { + NSInteger numberOfHogs; + if (hogs <= HW_getMaxNumberOfHogs() && hogs >= 1) + numberOfHogs = hogs; + else { + if (hogs > HW_getMaxNumberOfHogs()) + numberOfHogs = 1; + else + numberOfHogs = HW_getMaxNumberOfHogs(); + } + return numberOfHogs; +} + +-(UIImage *)drawHogsRepeated:(NSInteger) manyTimes { + UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:HEDGEHOG_FILE()]; + CGFloat screenScale = getScreenScale(); + int w = hogSprite.size.width * screenScale; + int h = hogSprite.size.height * screenScale; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, w * 3, h, 8, 4 * w * 3, colorSpace, kCGImageAlphaPremultipliedFirst); + + // draw the two images in the current context + for (int i = 0; i < manyTimes; i++) + CGContextDrawImage(context, CGRectMake(i*8*screenScale, 0, w, h), [hogSprite CGImage]); + [hogSprite release]; + + // Create bitmap image info from pixel data in current context + CGImageRef imageRef = CGBitmapContextCreateImage(context); + + // Create a new UIImage object + UIImage *resultImage; + if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; + else + resultImage = [UIImage imageWithCGImage:imageRef]; + + // Release colorspace, context and bitmap information + CGColorSpaceRelease(colorSpace); + CGContextRelease(context); + CFRelease(imageRef); + + return resultImage; +} #pragma mark - #pragma mark Table view data source @@ -98,9 +138,9 @@ -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) - return [listOfSelectedTeams count] ; + return selectedTeamsCount; else - return [listOfTeams count]; + return allTeamsCount; } // Customize the appearance of table view cells. @@ -113,52 +153,36 @@ if (section == 0) { cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; - - UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)]; - numberButton.tag = NUMBERBUTTON_TAG; - [cell addSubview:numberButton]; - [numberButton release]; - - SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+6, 5, 36, 36)]; - squareButton.tag = SQUAREBUTTON_TAG; - [cell addSubview:squareButton]; - [squareButton release]; + cell = [[[HoldTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; - NSInteger length; - if (IS_IPAD()) - length = 103; - else - length = 285; - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+6+36, 10, length, 25)]; - label.textAlignment = UITextAlignmentLeft; - label.minimumFontSize = 11; - label.adjustsFontSizeToFitWidth = YES; - label.baselineAdjustment = UIBaselineAdjustmentAlignCenters; - label.backgroundColor = [UIColor clearColor]; - label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; - label.textColor = UICOLOR_HW_YELLOW_TEXT; - label.tag = LABEL_TAG; - [cell.contentView addSubview:label]; - [label release]; + SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(0, 0, 36, 36)]; + cell.accessoryView = squareButton; + [squareButton release]; } NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]]; - - UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG]; - cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; + cell.textLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; + cell.textLabel.backgroundColor = [UIColor clearColor]; - HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG]; - [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]]; - numberButton.ownerDictionary = selectedRow; + SquareButtonView *squareButton = (SquareButtonView *)cell.accessoryView; + [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; + NSNumber *hogNumber = [selectedRow objectForKey:@"number"]; + [squareButton setTitle:[hogNumber stringValue] forState:UIControlStateNormal]; + squareButton.ownerDictionary = selectedRow; - SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG]; - [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; - squareButton.ownerDictionary = selectedRow; + cell.imageView.image = [self drawHogsRepeated:[hogNumber intValue]]; + ((HoldTableViewCell *)cell).delegate = self; + } else { + cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; + + cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; + cell.textLabel.backgroundColor = [UIColor clearColor]; - NSString *teamPath = [NSString stringWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[selectedRow objectForKey:@"team"]]; + NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text]; NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0]; - if ([[firstHog objectForKey:@"level"] intValue]> 0) { + if ([[firstHog objectForKey:@"level"] intValue] != 0) { NSString *filePath = [NSString stringWithFormat:@"%@/cyborg.png",HATS_DIRECTORY()]; UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath andCutAt:CGRectMake(0, 2, 32, 32)]; UIImageView *spriteView = [[UIImageView alloc] initWithImage:sprite]; @@ -168,18 +192,12 @@ [spriteView release]; } else cell.accessoryView = nil; - } else { - cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; + } - cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; - cell.accessoryView = nil; - } - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; - cell.backgroundColor = [UIColor blackColor]; - + cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; } @@ -190,7 +208,7 @@ -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30); NSString *text; - if (section == 0) + if (section == 0) text = NSLocalizedString(@"Playing Teams",@""); else text = NSLocalizedString(@"Available Teams",@""); @@ -203,6 +221,32 @@ return theView; } +-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + return 20; +} + +-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section { + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 20)]; + footer.backgroundColor = [UIColor clearColor]; + + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*80/100, 20)]; + label.center = CGPointMake(self.tableView.frame.size.width/2, 20/2); + label.textAlignment = UITextAlignmentCenter; + label.font = [UIFont italicSystemFontOfSize:12]; + label.textColor = [UIColor whiteColor]; + label.numberOfLines = 1; + if (section == 0) + label.text = NSLocalizedString(@"Tap to add hogs or change color, hold tap to remove team.",@""); + else + label.text = NSLocalizedString(@"The robot badge indicates an AI-controlled team.",@""); + + label.backgroundColor = [UIColor clearColor]; + [footer addSubview:label]; + [label release]; + return [footer autorelease]; +} + + #pragma mark - #pragma mark Table view delegate -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -210,15 +254,49 @@ NSInteger section = [indexPath section]; if (section == 0) { - [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; - [self.listOfSelectedTeams removeObjectAtIndex:row]; + NSMutableDictionary *selectedRow = [self.listOfSelectedTeams objectAtIndex:[indexPath row]]; + UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath]; + SquareButtonView *squareButton = (SquareButtonView *)cell.accessoryView; + + NSInteger increaseNumber = [[selectedRow objectForKey:@"number"] intValue] + 1; + NSNumber *newNumber = [NSNumber numberWithInt:[self filterNumberOfHogs:increaseNumber]]; + [squareButton setTitle:[newNumber stringValue] forState:UIControlStateNormal]; + [selectedRow setObject:newNumber forKey:@"number"]; + + cell.imageView.image = [self drawHogsRepeated:[newNumber intValue]]; + [cell setNeedsLayout]; } else { [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]]; [self.listOfTeams removeObjectAtIndex:row]; + + NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:selectedTeamsCount inSection:0]; + allTeamsCount--; + selectedTeamsCount++; + [aTableView beginUpdates]; + [aTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationRight]; + [aTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight]; + [aTableView endUpdates]; } - [aTableView reloadData]; } +-(void) holdAction:(NSString *)content { + NSInteger row; + for (row = 0; row < [self.listOfSelectedTeams count]; row++) { + NSDictionary *dict = [self.listOfSelectedTeams objectAtIndex:row]; + if ([content isEqualToString:[[dict objectForKey:@"team"] stringByDeletingPathExtension]]) + break; + } + + [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; + [self.listOfSelectedTeams removeObjectAtIndex:row]; + + [self.tableView beginUpdates]; + [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; + [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:allTeamsCount inSection:1]] withRowAnimation:UITableViewRowAnimationLeft]; + allTeamsCount++; + selectedTeamsCount--; + [self.tableView endUpdates]; +} #pragma mark - #pragma mark Memory management diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Classes/UIImageExtra.m --- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m Wed Dec 08 14:47:52 2010 +0100 @@ -35,7 +35,10 @@ DLog(@"warning - this is a very expensive operation, you should avoid using it"); // Create a bitmap graphics context; this will also set it as the current context - UIGraphicsBeginImageContext(size); + if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) + UIGraphicsBeginImageContextWithOptions(size, NO, getScreenScale()); + else + UIGraphicsBeginImageContext(size); // Draw the scaled image in the current context [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; @@ -60,8 +63,9 @@ DLog(@"Warning, secondImage == nil"); return self; } - int w = resultingSize.width; - int h = resultingSize.height; + CGFloat screenScale = getScreenScale(); + int w = resultingSize.width * screenScale; + int h = resultingSize.height * screenScale; if (w == 0 || h == 0) { DLog(@"Can have 0 dimesions"); @@ -73,14 +77,18 @@ CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); // draw the two images in the current context - CGContextDrawImage(context, CGRectMake(0, 0, self.size.width, self.size.height), [self CGImage]); - CGContextDrawImage(context, CGRectMake(secondImagePoint.x, secondImagePoint.y, secondImage.size.width, secondImage.size.height), [secondImage CGImage]); + CGContextDrawImage(context, CGRectMake(0, 0, self.size.width*screenScale, self.size.height*screenScale), [self CGImage]); + CGContextDrawImage(context, CGRectMake(secondImagePoint.x*screenScale, secondImagePoint.y*screenScale, secondImage.size.width*screenScale, secondImage.size.height*screenScale), [secondImage CGImage]); // Create bitmap image info from pixel data in current context CGImageRef imageRef = CGBitmapContextCreateImage(context); // Create a new UIImage object - UIImage *resultImage = [UIImage imageWithCGImage:imageRef]; + UIImage *resultImage; + if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; + else + resultImage = [UIImage imageWithCGImage:imageRef]; // Release colorspace, context and bitmap information CGColorSpaceRelease(colorSpace); @@ -200,9 +208,9 @@ -(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh { CGFloat cornerWidth = sizewh.width; CGFloat cornerHeight = sizewh.height; - CGFloat theScale = getScreenScale(); - CGFloat w = self.size.width * theScale; - CGFloat h = self.size.height * theScale; + CGFloat screenScale = getScreenScale(); + CGFloat w = self.size.width * screenScale; + CGFloat h = self.size.height * screenScale; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); @@ -221,7 +229,7 @@ UIImage *newImage; if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) - newImage = [UIImage imageWithCGImage:imageMasked scale:theScale orientation:UIImageOrientationUp]; + newImage = [UIImage imageWithCGImage:imageMasked scale:screenScale orientation:UIImageOrientationUp]; else newImage = [UIImage imageWithCGImage:imageMasked]; diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Wed Dec 08 14:47:52 2010 +0100 @@ -107,7 +107,6 @@ 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */; }; 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165922311CA9BD500D6E256 /* CGPointUtils.c */; }; 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922611CA9BD500D6E256 /* CommodityFunctions.m */; }; - 6165923011CA9BD500D6E256 /* HogButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922811CA9BD500D6E256 /* HogButtonView.m */; }; 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922B11CA9BD500D6E256 /* SquareButtonView.m */; }; 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922D11CA9BD500D6E256 /* UIImageExtra.m */; }; 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */; }; @@ -205,6 +204,7 @@ 61F2E7CE1205EDE0005734F7 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */; }; 61F2E7CF1205EDE0005734F7 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */; }; 61F2E7EC12060E31005734F7 /* checkbox.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F2E7EB12060E31005734F7 /* checkbox.png */; }; + 61F544C712AF1748007FD913 /* HoldTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F544C612AF1748007FD913 /* HoldTableViewCell.m */; }; 61F7A43811E290650040BA66 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43111E290650040BA66 /* Icon-72.png */; }; 61F7A43911E290650040BA66 /* Icon-Small-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43211E290650040BA66 /* Icon-Small-50.png */; }; 61F7A43A11E290650040BA66 /* Icon-Small.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43311E290650040BA66 /* Icon-Small.png */; }; @@ -863,8 +863,6 @@ 6165922411CA9BD500D6E256 /* CGPointUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGPointUtils.h; path = Classes/CGPointUtils.h; sourceTree = ""; }; 6165922511CA9BD500D6E256 /* CommodityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommodityFunctions.h; path = Classes/CommodityFunctions.h; sourceTree = ""; }; 6165922611CA9BD500D6E256 /* CommodityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommodityFunctions.m; path = Classes/CommodityFunctions.m; sourceTree = ""; }; - 6165922711CA9BD500D6E256 /* HogButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HogButtonView.h; path = Classes/HogButtonView.h; sourceTree = ""; }; - 6165922811CA9BD500D6E256 /* HogButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HogButtonView.m; path = Classes/HogButtonView.m; sourceTree = ""; }; 6165922911CA9BD500D6E256 /* PascalImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PascalImports.h; path = Classes/PascalImports.h; sourceTree = ""; }; 6165922A11CA9BD500D6E256 /* SquareButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SquareButtonView.h; path = Classes/SquareButtonView.h; sourceTree = ""; }; 6165922B11CA9BD500D6E256 /* SquareButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SquareButtonView.m; path = Classes/SquareButtonView.m; sourceTree = ""; }; @@ -960,8 +958,8 @@ 61A4A39212A5CCC2004D81E6 /* uUtils.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uUtils.pas; path = ../../hedgewars/uUtils.pas; sourceTree = SOURCE_ROOT; }; 61A4A39312A5CCC2004D81E6 /* uVariables.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uVariables.pas; path = ../../hedgewars/uVariables.pas; sourceTree = SOURCE_ROOT; }; 61A4A3A112A5CD56004D81E6 /* uCaptions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCaptions.pas; path = ../../hedgewars/uCaptions.pas; sourceTree = SOURCE_ROOT; }; - 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditableCellView.h; sourceTree = ""; }; - 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditableCellView.m; sourceTree = ""; }; + 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditableCellView.h; path = Classes/EditableCellView.h; sourceTree = ""; }; + 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EditableCellView.m; path = Classes/EditableCellView.m; sourceTree = ""; }; 61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = ""; }; 61D205A0127CDD1100ABD83E /* ObjcExports.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcExports.m; path = Classes/ObjcExports.m; sourceTree = ""; }; 61D3D2A41290E03A003CE7C3 /* irc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = irc.png; path = Resources/Icons/irc.png; sourceTree = ""; }; @@ -985,6 +983,8 @@ 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutViewController.m; sourceTree = ""; }; 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = AboutViewController.xib; path = ../Resources/AboutViewController.xib; sourceTree = ""; }; 61F2E7EB12060E31005734F7 /* checkbox.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = checkbox.png; path = Resources/Icons/checkbox.png; sourceTree = ""; }; + 61F544C512AF1748007FD913 /* HoldTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HoldTableViewCell.h; path = Classes/HoldTableViewCell.h; sourceTree = ""; }; + 61F544C612AF1748007FD913 /* HoldTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HoldTableViewCell.m; path = Classes/HoldTableViewCell.m; sourceTree = ""; }; 61F7A43111E290650040BA66 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "Resources/Icons/Icon-72.png"; sourceTree = ""; }; 61F7A43211E290650040BA66 /* Icon-Small-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-Small-50.png"; path = "Resources/Icons/Icon-Small-50.png"; sourceTree = ""; }; 61F7A43311E290650040BA66 /* Icon-Small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-Small.png"; path = "Resources/Icons/Icon-Small.png"; sourceTree = ""; }; @@ -995,8 +995,8 @@ 61F9040811DF58B00068B24D /* settingsButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = settingsButton.png; path = Resources/Frontend/settingsButton.png; sourceTree = ""; }; 61F9040A11DF59370068B24D /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = Resources/Frontend/background.png; sourceTree = ""; }; 61F9040D11DF59D10068B24D /* netplayButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = netplayButton.png; path = Resources/Frontend/netplayButton.png; sourceTree = ""; }; - 61F904D511DF7DA30068B24D /* WeaponCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeaponCellView.h; sourceTree = ""; }; - 61F904D611DF7DA30068B24D /* WeaponCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeaponCellView.m; sourceTree = ""; }; + 61F904D511DF7DA30068B24D /* WeaponCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WeaponCellView.h; path = Classes/WeaponCellView.h; sourceTree = ""; }; + 61F904D611DF7DA30068B24D /* WeaponCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WeaponCellView.m; path = Classes/WeaponCellView.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 928301170F10CAFC00CC5A3C /* libfpc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpc.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -1076,7 +1076,7 @@ children = ( 6165929C11CA9E2F00D6E256 /* SDL_uikitappdelegate.h */, 6165929D11CA9E2F00D6E256 /* SDL_uikitappdelegate.m */, - 61DE91561258B76800B80214 /* Custom Buttons */, + 61DE91561258B76800B80214 /* Custom UIs */, 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */, 6165922911CA9BD500D6E256 /* PascalImports.h */, 61D2059F127CDD1100ABD83E /* ObjcExports.h */, @@ -1299,10 +1299,6 @@ 6163EE7D11CC2600001C0453 /* SingleWeaponViewController.m */, 616591FE11CA9BA200D6E256 /* SingleSchemeViewController.h */, 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */, - 61C079E211F35A300072BF46 /* EditableCellView.h */, - 61C079E311F35A300072BF46 /* EditableCellView.m */, - 61F904D511DF7DA30068B24D /* WeaponCellView.h */, - 61F904D611DF7DA30068B24D /* WeaponCellView.m */, ); name = "Second Level"; sourceTree = ""; @@ -1426,17 +1422,21 @@ name = Products; sourceTree = ""; }; - 61DE91561258B76800B80214 /* Custom Buttons */ = { + 61DE91561258B76800B80214 /* Custom UIs */ = { isa = PBXGroup; children = ( - 6165922711CA9BD500D6E256 /* HogButtonView.h */, - 6165922811CA9BD500D6E256 /* HogButtonView.m */, + 619C5BA0124FA59000D041AE /* MapPreviewButtonView.h */, + 619C5BA1124FA59000D041AE /* MapPreviewButtonView.m */, + 61F544C512AF1748007FD913 /* HoldTableViewCell.h */, + 61F544C612AF1748007FD913 /* HoldTableViewCell.m */, 6165922A11CA9BD500D6E256 /* SquareButtonView.h */, 6165922B11CA9BD500D6E256 /* SquareButtonView.m */, - 619C5BA0124FA59000D041AE /* MapPreviewButtonView.h */, - 619C5BA1124FA59000D041AE /* MapPreviewButtonView.m */, + 61C079E211F35A300072BF46 /* EditableCellView.h */, + 61C079E311F35A300072BF46 /* EditableCellView.m */, + 61F904D511DF7DA30068B24D /* WeaponCellView.h */, + 61F904D611DF7DA30068B24D /* WeaponCellView.m */, ); - name = "Custom Buttons"; + name = "Custom UIs"; sourceTree = ""; }; 61F7A42811E2905C0040BA66 /* Icons */ = { @@ -2380,7 +2380,6 @@ 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */, 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */, 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */, - 6165923011CA9BD500D6E256 /* HogButtonView.m in Sources */, 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */, 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */, 6165929E11CA9E2F00D6E256 /* SDL_uikitappdelegate.m in Sources */, @@ -2412,6 +2411,7 @@ 61A4A39E12A5CCC2004D81E6 /* uVariables.pas in Sources */, 61A4A3A212A5CD56004D81E6 /* uCaptions.pas in Sources */, 61E5D68D12AB006F00566F29 /* uLandPainted.pas in Sources */, + 61F544C712AF1748007FD913 /* HoldTableViewCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Resources/GameConfigViewController.xib --- a/project_files/HedgewarsMobile/Resources/GameConfigViewController.xib Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Resources/GameConfigViewController.xib Wed Dec 08 14:47:52 2010 +0100 @@ -1,14 +1,14 @@ - 1024 + 1056 10H574 - 804 + 823 1038.35 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 + 132 YES @@ -50,7 +50,7 @@ 292 - {{87, 8}, {265, 30}} + {{96, 8}, {269, 30}} NO 12345 @@ -120,7 +120,6 @@ IBCocoaTouchFramework - 265 @@ -131,9 +130,9 @@ 1 - Start Game + Start IBCocoaTouchFramework - 90 + 68 2 @@ -535,6 +534,13 @@ UIView IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource UIKit.framework/Headers/UITextField.h @@ -588,7 +594,7 @@ IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 @@ -597,6 +603,6 @@ YES ../Hedgewars.xcodeproj 3 - 123 + 132 diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPhone.xib Tue Dec 07 01:18:43 2010 +0100 +++ b/project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPhone.xib Wed Dec 08 14:47:52 2010 +0100 @@ -12,7 +12,7 @@ YES - + YES @@ -42,42 +42,16 @@ 292 YES - + 274 YES - - + + 292 - {{13, 3}, {440, 30}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can find help for the various game elements. - - Helvetica-Oblique - 16 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - 0 - 1 - - - - 292 - {{20, 311}, {150, 22}} - + {{20, 283}, {150, 22}} + NO YES 7 @@ -89,16 +63,19 @@ 18 16 - + + 1 + MCAwIDAAA + 1 10 - - + + 292 - {{20, 320}, {203, 85}} - + {{20, 292}, {203, 85}} + NO YES 7 @@ -116,11 +93,11 @@ 10 0 - - + + 292 - {{20, 41}, {186, 22}} - + {{20, 13}, {186, 22}} + NO YES 7 @@ -133,11 +110,11 @@ 1 10 - - + + 292 - {{20, 62}, {187, 43}} - + {{20, 34}, {187, 43}} + NO YES 7 @@ -151,11 +128,11 @@ 10 0 - - + + 292 - {{217, 336}, {243, 22}} - + {{217, 308}, {243, 22}} + NO YES 7 @@ -169,11 +146,11 @@ 10 2 - - + + 292 - {{231, 356}, {229, 87}} - + {{231, 328}, {229, 87}} + NO YES 7 @@ -188,11 +165,11 @@ 0 2 - - + + 292 - {{20, 113}, {186, 22}} - + {{20, 85}, {186, 22}} + NO YES 7 @@ -205,11 +182,11 @@ 1 10 - - + + 292 - {{20, 129}, {191, 63}} - + {{20, 101}, {191, 63}} + NO YES 7 @@ -223,11 +200,11 @@ 10 0 - - + + 292 - {{20, 200}, {203, 22}} - + {{20, 172}, {203, 22}} + NO YES 7 @@ -240,11 +217,11 @@ 1 10 - - + + 292 - {{20, 219}, {203, 85}} - + {{20, 191}, {203, 85}} + NO YES 7 @@ -258,11 +235,11 @@ 10 4 - - + + 292 - {{274, 41}, {186, 22}} - + {{274, 13}, {186, 22}} + NO YES 7 @@ -276,11 +253,11 @@ 10 2 - - + + 292 - {{273, 63}, {187, 43}} - + {{273, 35}, {187, 43}} + NO YES 7 @@ -295,11 +272,11 @@ 0 2 - - + + 292 - {{351, 110}, {109, 22}} - + {{351, 82}, {109, 22}} + NO YES 7 @@ -313,11 +290,11 @@ 10 2 - - + + 292 - {{246, 133}, {214, 84}} - + {{246, 105}, {214, 84}} + NO YES 7 @@ -332,11 +309,11 @@ 0 2 - - + + 292 - {{325, 225}, {135, 22}} - + {{325, 197}, {135, 22}} + NO YES 7 @@ -350,11 +327,11 @@ 10 2 - - + + 292 - {{249, 245}, {211, 85}} - + {{249, 217}, {211, 85}} + NO YES 7 @@ -369,43 +346,34 @@ 0 2 - - - 292 - {{203, 34}, {60, 37}} - - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 1 - Back - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - {489, 332} + {{-5, 44}, {489, 332}} YES YES 1 IBCocoaTouchFramework + + + 290 + {{-1, 0}, {481, 44}} + + IBCocoaTouchFramework + + YES + + + Help page + + Back + IBCocoaTouchFramework + + + IBCocoaTouchFramework + + + {480, 320} @@ -432,21 +400,20 @@ 3 + + dismiss + + + + 141 + + scrollView - + - 115 - - - - dismiss - - - 7 - - 117 + 142 @@ -474,125 +441,137 @@ YES - + + - 97 - + 118 + + + YES + + + + + + 121 + YES - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - 98 - - + 122 + + - 99 - - + 124 + + - 100 - - + 125 + + + + + 126 + + - 101 - - + 127 + + - 102 - - + 128 + + - 103 - - + 129 + + - 104 - - + 130 + + - 105 - - + 131 + + - 106 - - + 132 + + - 107 - - + 133 + + - 108 - - + 134 + + - 109 - - + 135 + + - 110 - - + 136 + + - 111 - - + 137 + + - 112 - - + 138 + + - 113 - - + 119 + + + YES + + + - 114 - - - - - 116 - - + 140 + + @@ -602,48 +581,48 @@ YES -1.CustomClassName -2.CustomClassName - 100.IBPluginDependency - 100.IBViewBoundsToFrameTransform - 101.IBPluginDependency - 101.IBViewBoundsToFrameTransform - 102.IBPluginDependency - 102.IBViewBoundsToFrameTransform - 103.IBPluginDependency - 103.IBViewBoundsToFrameTransform - 104.IBPluginDependency - 104.IBViewBoundsToFrameTransform - 105.IBPluginDependency - 105.IBViewBoundsToFrameTransform - 106.IBPluginDependency - 106.IBViewBoundsToFrameTransform - 107.IBPluginDependency - 107.IBViewBoundsToFrameTransform - 108.IBPluginDependency - 108.IBViewBoundsToFrameTransform - 109.IBPluginDependency - 109.IBViewBoundsToFrameTransform - 110.IBPluginDependency - 110.IBViewBoundsToFrameTransform - 111.IBPluginDependency - 111.IBViewBoundsToFrameTransform - 112.IBPluginDependency - 112.IBViewBoundsToFrameTransform - 113.IBPluginDependency - 113.IBViewBoundsToFrameTransform - 114.IBPluginDependency - 114.IBViewBoundsToFrameTransform - 116.IBPluginDependency - 116.IBViewBoundsToFrameTransform + 118.IBPluginDependency + 118.IBViewBoundsToFrameTransform + 119.IBPluginDependency + 121.IBEditorWindowLastContentRect + 121.IBPluginDependency + 121.IBViewBoundsToFrameTransform + 122.IBPluginDependency + 122.IBViewBoundsToFrameTransform + 124.IBPluginDependency + 124.IBViewBoundsToFrameTransform + 125.IBPluginDependency + 125.IBViewBoundsToFrameTransform + 126.IBPluginDependency + 126.IBViewBoundsToFrameTransform + 127.IBPluginDependency + 127.IBViewBoundsToFrameTransform + 128.IBPluginDependency + 128.IBViewBoundsToFrameTransform + 129.IBPluginDependency + 129.IBViewBoundsToFrameTransform + 130.IBPluginDependency + 130.IBViewBoundsToFrameTransform + 131.IBPluginDependency + 131.IBViewBoundsToFrameTransform + 132.IBPluginDependency + 132.IBViewBoundsToFrameTransform + 133.IBPluginDependency + 133.IBViewBoundsToFrameTransform + 134.IBPluginDependency + 134.IBViewBoundsToFrameTransform + 135.IBPluginDependency + 135.IBViewBoundsToFrameTransform + 136.IBPluginDependency + 136.IBViewBoundsToFrameTransform + 137.IBPluginDependency + 137.IBViewBoundsToFrameTransform + 138.IBPluginDependency + 138.IBViewBoundsToFrameTransform + 140.IBPluginDependency 2.IBEditorWindowLastContentRect 2.IBPluginDependency 2.IBViewBoundsToFrameTransform - 97.IBEditorWindowLastContentRect - 97.IBPluginDependency - 97.IBViewBoundsToFrameTransform - 98.IBPluginDependency - 98.IBViewBoundsToFrameTransform - 99.IBPluginDependency - 99.IBViewBoundsToFrameTransform YES @@ -651,11 +630,57 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDdgAAw1oAAA + AQAAAADAQAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{589, 578}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AcCgAABCMAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDZwAAw7aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCVAAAwx8AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAwnQAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCxgAAwtYAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDr4AAwwUAAA + P4AAAL+AAABCxgAAwyQAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw+SAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAxARAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw6aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw8+AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDZwAAw+EAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDiQAAwmwAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -663,71 +688,25 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDiQAAwmwAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw+EAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw8+AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw6aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAxARAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw+SAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCxgAAwyQAAA + P4AAAL+AAABDr4AAwwUAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABCxgAAwtYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAwnQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCVAAAwx8AAA + P4AAAL+AAABDdgAAw1oAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABBUAAAwnQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw7aAAA + P4AAAL+AAABDooAAw3gAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDSwAAwooAAA - - {{165, 514}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw4kAAA - - {{589, 578}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDeQAAw6aAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{165, 514}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABDooAAw3gAAA + P4AAAL+AAAAAAAAAw4kAAA @@ -747,7 +726,7 @@ - 117 + 142 @@ -891,19 +870,19 @@ - UIButton - UIControl + UIBarButtonItem + UIBarItem IBFrameworkSource - UIKit.framework/Headers/UIButton.h + UIKit.framework/Headers/UIBarButtonItem.h - UIControl - UIView + UIBarItem + NSObject IBFrameworkSource - UIKit.framework/Headers/UIControl.h + UIKit.framework/Headers/UIBarItem.h @@ -915,6 +894,19 @@ + UINavigationBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UINavigationBar.h + + + + UINavigationItem + NSObject + + + UIResponder NSObject diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Resources/Settings/Images/hedgehog.png Binary file project_files/HedgewarsMobile/Resources/Settings/Images/hedgehog.png has changed diff -r 499748f6e80f -r 4bf74e158f44 project_files/HedgewarsMobile/Resources/Settings/Images/hedgehog@2x.png Binary file project_files/HedgewarsMobile/Resources/Settings/Images/hedgehog@2x.png has changed