# HG changeset patch # User koda # Date 1269596426 0 # Node ID c22b395b6a2ed4fe2f19662c73bf8a0e2502cefe # Parent b18038b3a0f49ad2118f74ac4f05d1258440bdea add another button to close the game and return to the iFrontend (untested) diff -r b18038b3a0f4 -r c22b395b6a2e cocoaTouch/overlayViewController.h --- a/cocoaTouch/overlayViewController.h Fri Mar 26 03:04:19 2010 +0000 +++ b/cocoaTouch/overlayViewController.h Fri Mar 26 09:40:26 2010 +0000 @@ -9,7 +9,7 @@ #import -@interface overlayViewController : UIViewController { +@interface overlayViewController : UIViewController { NSTimer *dimTimer; CGFloat initialDistanceForPinching; diff -r b18038b3a0f4 -r c22b395b6a2e cocoaTouch/overlayViewController.m --- a/cocoaTouch/overlayViewController.m Fri Mar 26 03:04:19 2010 +0000 +++ b/cocoaTouch/overlayViewController.m Fri Mar 26 09:40:26 2010 +0000 @@ -94,7 +94,7 @@ UIButton *theButton = (UIButton *)sender; switch (theButton.tag) { case 0: - HW_walkLeft(); + HW_walkLeft(); break; case 1: HW_walkRight(); @@ -120,20 +120,42 @@ case 8: HW_chat(); break; + case 9: + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") + delegate:self + cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") + destructiveButtonTitle:NSLocalizedString(@"As sure as I can be!", @"") + otherButtonTitles:nil]; + [actionSheet showInView:self.view]; + [actionSheet release]; + + HW_pause(); + break; + case 10: + HW_tab(); + break; default: NSLog(@"Nope"); - // HW_chat() HW_tab() HW_pause() break; } } +-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { + if ([actionSheet cancelButtonIndex] != buttonIndex) + HW_terminate(NO); + else + HW_pause(); +} + -(IBAction) showPopover{ //UIViewController *content = [[UIViewController alloc] initWithNibName: nil bundle:nil]; //CGRect rectArea = CGRectMake(0, 0, 320, 480); //content.view.frame = rectArea; //settings.view.frame = rectArea; - popupMenuViewController *popupMenu = [[UIViewController alloc] initWithNibName:@"popupMenuViewController" bundle:nil]; + //popupMenuViewController *popupMenu = [[UIViewController alloc] initWithNibName:@"popupMenuViewController" bundle:nil]; + UIViewController *popupMenu = [[UIViewController alloc] init]; + UIButton *buttonPause = [UIButton buttonWithType:UIButtonTypeRoundedRect]; buttonPause.tag = 7; buttonPause.frame = CGRectMake(100, 170, 170, 30); @@ -146,20 +168,21 @@ buttonChat.frame = CGRectMake(100, 220, 170, 30); [buttonChat setTitle:@"Chat" forState:UIControlStateNormal]; [buttonChat addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; - [popupMenu.view addSubview: buttonChat]; - + [popupMenu.view addSubview:buttonChat]; + + UIButton *buttonEnd = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + buttonEnd.tag = 9; + buttonEnd.frame = CGRectMake(100, 270, 170, 30); + [buttonEnd setTitle:@"End Game" forState:UIControlStateNormal]; + [buttonEnd addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; + [popupMenu.view addSubview:buttonEnd]; UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:popupMenu]; - //[aPopover setPopoverContentSize:CGSizeMake(320, 480) animated:YES]; + [aPopover setPopoverContentSize:CGSizeMake(220, 480) animated:YES]; - [aPopover presentPopoverFromRect: CGRectMake(1024, 0, 320, 480) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; + [aPopover presentPopoverFromRect:CGRectMake(1024, 0, 320, 480) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; //UIBarButtonItem *sender = [[useless items] objectAtIndex:1]; //[self.popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; - //aPopover.popoverContentSize = CGSizeMake(320, 480); - - /*SettingsViewController *settings = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil]; - UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:settings]; - [self.view addSubview:popover.contentViewController.view];*/ }