# HG changeset patch # User koda # Date 1279342599 -7200 # Node ID 2477029463edf2ece04a2542358a0944cd07fdaf # Parent 0d0df215fb5287af4bafdf2491d2d68443c994ea some further chat polishing diff -r 0d0df215fb52 -r 2477029463ed hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Sat Jul 17 03:59:10 2010 +0200 +++ b/hedgewars/PascalExports.pas Sat Jul 17 06:56:39 2010 +0200 @@ -13,7 +13,7 @@ unit PascalExports; interface -uses uKeys, GLunit, uWorld, uMisc, uGears, uConsole, uTeams, uConsts, hwengine; +uses uKeys, GLunit, uWorld, uMisc, uConsole, uTeams, uConsts, uChat, hwengine; {$INCLUDE "config.inc"} @@ -118,6 +118,12 @@ chatAction:= true; end; +procedure HW_chatEnd; cdecl; export; +begin + KeyPressChat(27); // esc - cleans buffer + KeyPressChat(13); // enter - removes chat +end; + procedure HW_tab; cdecl; export; begin switchAction:= true; diff -r 0d0df215fb52 -r 2477029463ed project_files/HedgewarsMobile/Classes/InGameMenuViewController.h --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Sat Jul 17 03:59:10 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Sat Jul 17 06:56:39 2010 +0200 @@ -14,6 +14,11 @@ BOOL isPaused; SDL_Window *sdlwindow; } + @property (nonatomic,retain) NSArray *menuList; +-(void) present; +-(void) dismiss; +-(void) removeChat; + @end diff -r 0d0df215fb52 -r 2477029463ed project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Sat Jul 17 03:59:10 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Sat Jul 17 06:56:39 2010 +0200 @@ -40,7 +40,7 @@ SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_VideoDisplay *display = &_this->displays[0]; sdlwindow = display->windows; - + [super viewDidLoad]; } @@ -56,6 +56,31 @@ } #pragma mark - +#pragma mark animating +-(void) present { + CGRect screen = [[UIScreen mainScreen] bounds]; + self.view.backgroundColor = [UIColor clearColor]; + self.view.frame = CGRectMake(screen.size.height, 0, 200, 170); + + [UIView beginAnimations:@"showing popover" context:NULL]; + [UIView setAnimationDuration:0.35]; + self.view.frame = CGRectMake(screen.size.height-200, 0, 200, 170); + [UIView commitAnimations]; +} + +-(void) dismiss { + CGRect screen = [[UIScreen mainScreen] bounds]; + [UIView beginAnimations:@"hiding popover" context:NULL]; + [UIView setAnimationDuration:0.35]; + self.view.frame = CGRectMake(screen.size.height, 0, 200, 170); + [UIView commitAnimations]; + + [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35]; + + [self removeChat]; +} + +#pragma mark - #pragma mark tableView methods -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { return 1; @@ -87,16 +112,21 @@ isPaused = !isPaused; break; case 1: - HW_chat(); - SDL_iPhoneKeyboardShow(sdlwindow); + if (SDL_iPhoneKeyboardIsShown(sdlwindow)) + [self removeChat]; + else { + HW_chat(); + SDL_iPhoneKeyboardShow(sdlwindow); + } break; case 2: // expand the view (and table) so that the actionsheet can be selected on the iPhone if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { + CGRect screen = [[UIScreen mainScreen] bounds]; [self.tableView deselectRowAtIndexPath:indexPath animated:NO]; [UIView beginAnimations:@"table width more" context:NULL]; [UIView setAnimationDuration:0.2]; - self.view.frame = CGRectMake(0, 0, 480, 320); + self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); [UIView commitAnimations]; } actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") @@ -118,6 +148,12 @@ [aTableView deselectRowAtIndexPath:indexPath animated:YES]; } +-(void) removeChat { + HW_chatEnd(); + if (SDL_iPhoneKeyboardIsShown(sdlwindow)) + SDL_iPhoneKeyboardHide(sdlwindow); +} + #pragma mark - #pragma mark actionSheet methods -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { diff -r 0d0df215fb52 -r 2477029463ed project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Jul 17 03:59:10 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Jul 17 06:56:39 2010 +0200 @@ -11,9 +11,9 @@ #import "PascalImports.h" #import "CGPointUtils.h" #import "SDL_mouse.h" -#import "SDL_config_iphoneos.h" #import "InGameMenuViewController.h" #import "CommodityFunctions.h" +#import "SDL_config_iphoneos.h" #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] #define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] @@ -35,7 +35,7 @@ UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; CGRect rect = [[UIScreen mainScreen] bounds]; CGRect usefulRect = CGRectMake(0, 0, rect.size.width, rect.size.height); - UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:12345]; + UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG]; [UIView beginAnimations:@"rotation" context:NULL]; [UIView setAnimationDuration:0.8f]; @@ -276,17 +276,11 @@ permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; } else { - if (popupMenu == nil) { + if (popupMenu == nil) popupMenu = [[InGameMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; - popupMenu.view.backgroundColor = [UIColor clearColor]; - popupMenu.view.frame = CGRectMake(480, 0, 200, 170); - } + [self.view addSubview:popupMenu.view]; - - [UIView beginAnimations:@"showing popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - popupMenu.view.frame = CGRectMake(280, 0, 200, 170); - [UIView commitAnimations]; + [popupMenu present]; } popupMenu.tableView.scrollEnabled = NO; } @@ -297,14 +291,10 @@ isPopoverVisible = NO; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + [(InGameMenuViewController *)popoverController.contentViewController removeChat]; [popoverController dismissPopoverAnimated:YES]; } else { - [UIView beginAnimations:@"hiding popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - popupMenu.view.frame = CGRectMake(480, 0, 200, 170); - [UIView commitAnimations]; - - [popupMenu.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35]; + [popupMenu dismiss]; } [self buttonReleased:nil]; } @@ -325,10 +315,6 @@ if (isPopoverVisible) [self dismissPopover]; - // remove keyboard from the view - if (SDL_iPhoneKeyboardIsShown(sdlwindow)) - SDL_iPhoneKeyboardHide(sdlwindow); - // reset default dimming doDim(); diff -r 0d0df215fb52 -r 2477029463ed project_files/HedgewarsMobile/Classes/PascalImports.h --- a/project_files/HedgewarsMobile/Classes/PascalImports.h Sat Jul 17 03:59:10 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Sat Jul 17 06:56:39 2010 +0200 @@ -44,6 +44,7 @@ void HW_backjump(void); void HW_chat(void); + void HW_chatEnd(void); void HW_tab(void); void HW_pause(void); diff -r 0d0df215fb52 -r 2477029463ed project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Jul 17 03:59:10 2010 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Jul 17 06:56:39 2010 +0200 @@ -1280,9 +1280,9 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/OpenAL.framework/Headers, - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO; @@ -1397,9 +1397,9 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/OpenAL.framework/Headers, - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO; @@ -1597,9 +1597,9 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/OpenAL.framework/Headers, - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO; @@ -1637,9 +1637,9 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/OpenAL.framework/Headers, - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src\"/**", - "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO;