# HG changeset patch # User koda # Date 1285986212 -7200 # Node ID 44804043b691cf57d3eaddcc86d4b60e23a0de57 # Parent 022dfe1431b70e62d75b67fc6500dde4f90ca917 iPad Video Out support (+less warnings +code update for latest SDL) diff -r 022dfe1431b7 -r 44804043b691 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Oct 01 13:56:11 2010 -0400 +++ b/hedgewars/hwengine.pas Sat Oct 02 04:23:32 2010 +0200 @@ -219,15 +219,15 @@ cShowFPS:= false; // update me at release time {$ENDIF} val(gameArgs[0], ipcPort); - val(gameArgs[1], cScreenHeight); - val(gameArgs[2], cScreenWidth); + val(gameArgs[1], cScreenWidth); + val(gameArgs[2], cScreenHeight); val(gameArgs[3], cReducedQuality); cLocaleFName:= gameArgs[4]; UserNick:= gameArgs[5]; isSoundEnabled:= gameArgs[6] = '1'; isMusicEnabled:= gameArgs[7] = '1'; cAltDamage:= gameArgs[8] = '1'; - //gameArgs[9] unused + val(gameArgs[9], rotationQt); recordFileName:= gameArgs[10]; {$ENDIF} diff -r 022dfe1431b7 -r 44804043b691 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Oct 01 13:56:11 2010 -0400 +++ b/hedgewars/uStore.pas Sat Oct 02 04:23:32 2010 +0200 @@ -37,8 +37,6 @@ MissionIcons: PSDL_Surface; ropeIconTex: PTexture; rotationQt: GLfloat; - wScreen: LongInt; - hScreen: LongInt; procedure initModule; procedure freeModule; @@ -1145,12 +1143,6 @@ one: LongInt; {$ENDIF} begin - // initialized here because when initModule is called cScreenWidth/Height are not yet set - if (uStore.wScreen = 0) and (uStore.hScreen = 0) then - begin - uStore.wScreen:= cScreenWidth; - uStore.hScreen:= cScreenHeight; - end; {$IFDEF IPHONEOS} SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering @@ -1217,11 +1209,10 @@ {$ENDIF} // set view port to whole window -{$IFDEF IPHONEOS} - glViewport(0, 0, cScreenHeight, cScreenWidth); -{$ELSE} - glViewport(0, 0, cScreenWidth, cScreenHeight); -{$ENDIF} + if rotationQt = 0 then + glViewport(0, 0, cScreenWidth, cScreenHeight) + else + glViewport(0, 0, cScreenHeight, cScreenWidth); glMatrixMode(GL_MODELVIEW); // prepare default translation/scaling @@ -1255,7 +1246,7 @@ glPushMatrix; // save default scaling glLoadIdentity; glRotatef(rotationQt, 0, 0, 1); - glScalef(f / wScreen, -f / hScreen, 1.0); + glScalef(f / cScreenWidth, -f / cScreenHeight, 1.0); glTranslatef(0, -cScreenHeight / 2, 0); end; @@ -1292,7 +1283,7 @@ r.w:= squaresize; r.h:= squaresize; - DrawFromRect( -squaresize div 2, (hScreen - squaresize) shr 1, @r, ProgrTex); + DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); SDL_GL_SwapBuffers(); {$IFDEF SDL13} @@ -1566,15 +1557,11 @@ begin PixelFormat:= nil; SDLPrimSurface:= nil; -{$IFDEF IPHONEOS} - rotationQt:= -90; -{$ELSE} + +{$IFNDEF IPHONEOS} rotationQt:= 0; cGPUVendor:= gvUnknown; {$ENDIF} - // really initalized in storeLoad - uStore.wScreen:= 0; - uStore.hScreen:= 0; cScaleFactor:= 2.0; SupportNPOTT:= false; diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/CGPointUtils.c --- a/project_files/HedgewarsMobile/Classes/CGPointUtils.c Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/CGPointUtils.c Sat Oct 02 04:23:32 2010 +0200 @@ -8,7 +8,7 @@ */ #include "CGPointUtils.h" -#include +#include "math.h" CGFloat distanceBetweenPoints (CGPoint first, CGPoint second) { diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/GameSetup.m --- a/project_files/HedgewarsMobile/Classes/GameSetup.m Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Sat Oct 02 04:23:32 2010 +0200 @@ -434,11 +434,24 @@ #pragma mark Setting methods // returns an array of c-strings that are read by engine at startup -(const char **)getSettings: (NSString *)recordFile { + NSInteger width, height; NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; - NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; + NSString *rotation; + if ([[UIScreen screens] count] > 1) { + CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds]; + width = (int) screenBounds.size.width; + height = (int) screenBounds.size.height; + rotation = @"0"; + } else { + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + width = (int) screenBounds.size.height; + height = (int) screenBounds.size.width; + rotation = @"-90"; + } + + NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width]; + NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", height]; const char **gameArgs = (const char**) malloc(sizeof(char *) * 10); NSInteger tmpQuality; @@ -453,7 +466,7 @@ tmpQuality = 0x00000002; // rqBlurryLand else // = everything else tmpQuality = 0; // full quality - if (![modelId hasPrefix:@"iPad"]) // = disable tooltips unless iPad + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) // = disable tooltips on phone tmpQuality = tmpQuality | 0x00000400; // prevents using an empty nickname @@ -465,19 +478,19 @@ username = [[NSString alloc] initWithString:originalUsername]; gameArgs[ 0] = [ipcString UTF8String]; //ipcPort - gameArgs[ 1] = [wSize UTF8String]; //cScreenHeight - gameArgs[ 2] = [hSize UTF8String]; //cScreenWidth + gameArgs[ 1] = [horizontalSize UTF8String]; //cScreenWidth + gameArgs[ 2] = [verticalSize UTF8String]; //cScreenHeight gameArgs[ 3] = [[[NSNumber numberWithInteger:tmpQuality] stringValue] UTF8String]; //quality gameArgs[ 4] = "en.txt";//[localeString UTF8String]; //cLocaleFName gameArgs[ 5] = [username UTF8String]; //UserNick gameArgs[ 6] = [[[self.systemSettings objectForKey:@"sound"] stringValue] UTF8String]; //isSoundEnabled gameArgs[ 7] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String]; //isMusicEnabled gameArgs[ 8] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String]; //cAltDamage - gameArgs[ 9] = NULL; //unused + gameArgs[ 9] = [rotation UTF8String]; //rotateQt gameArgs[10] = [recordFile UTF8String]; //recordFileName - [wSize release]; - [hSize release]; + [verticalSize release]; + [horizontalSize release]; [localeString release]; [ipcString release]; [username release]; diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Sat Oct 02 04:23:32 2010 +0200 @@ -24,6 +24,7 @@ #import "PascalImports.h" #import "CommodityFunctions.h" #import "SDL_sysvideo.h" +#import "SDL_uikitkeyboard.h" @implementation InGameMenuViewController @synthesize menuList; @@ -177,8 +178,10 @@ [UIView commitAnimations]; } - if ([actionSheet cancelButtonIndex] != buttonIndex) + if ([actionSheet cancelButtonIndex] != buttonIndex) { + [[NSNotificationCenter defaultCenter] postNotificationName:@"remove overlay" object:nil]; HW_terminate(NO); + } } @end diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Sat Oct 02 04:23:32 2010 +0200 @@ -42,9 +42,6 @@ CGPoint startingPoint; BOOL isSegmentVisible; BOOL isAttacking; - - // the sdl window underneath - SDL_Window *sdlwindow; } @property (nonatomic,retain) id popoverController; diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Oct 02 04:23:32 2010 +0200 @@ -31,12 +31,13 @@ #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] #define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] -#define doDim() [dimTimer setFireDate:HIDING_TIME_DEFAULT] +#define doDim() [dimTimer setFireDate: ([[UIScreen screens] count] == 1) ? HIDING_TIME_DEFAULT : HIDING_TIME_NEVER] #define doNotDim() [dimTimer setFireDate:HIDING_TIME_NEVER] #define CONFIRMATION_TAG 5959 #define GRENADE_TAG 9595 -#define BLACKVIEW_TAG 9955 +#define REPLAYBLACKVIEW_TAG 9955 +#define ACTIVITYINDICATOR_TAG 987654 #define ANIMATION_DURATION 0.25 #define removeConfirmationInput() [[self.view viewWithTag:CONFIRMATION_TAG] removeFromSuperview]; @@ -58,12 +59,14 @@ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; switch (orientation) { case UIDeviceOrientationLandscapeLeft: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0)); + if ([[UIScreen screens] count] == 1) + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0)); self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90)); HW_setLandscape(YES); break; case UIDeviceOrientationLandscapeRight: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180)); + if ([[UIScreen screens] count] == 1) + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180)); self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); HW_setLandscape(YES); break; @@ -112,21 +115,23 @@ UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG]; switch (orientation) { case UIDeviceOrientationLandscapeLeft: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0)); + if ([[UIScreen screens] count] == 1) + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0)); self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90)); break; case UIDeviceOrientationLandscapeRight: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180)); + if ([[UIScreen screens] count] == 1) + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180)); self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); break; default: DLog(@"unknown orientation"); break; } - CGRect rect = [[UIScreen mainScreen] bounds]; - self.view.frame = CGRectMake(0, 0, rect.size.width, rect.size.height); + CGRect screenRect = [[UIScreen mainScreen] bounds]; + self.view.frame = CGRectMake(0, 0, screenRect.size.width, screenRect.size.height); - dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] + dimTimer = [[NSTimer alloc] initWithFireDate:([[UIScreen screens] count] == 1) ? [NSDate dateWithTimeIntervalSinceNow:6] : HIDING_TIME_NEVER interval:1000 target:self selector:@selector(dimOverlay) @@ -147,15 +152,15 @@ name:@"show help ingame" object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(cleanup) + name:@"remove overlay" + object:nil]; + [UIView beginAnimations:@"showing overlay" context:NULL]; [UIView setAnimationDuration:1]; self.view.alpha = 1; [UIView commitAnimations]; - - // find the sdl window we're on - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_VideoDisplay *display = &_this->displays[0]; - sdlwindow = display->windows; } -(void) showHelp:(id) sender { @@ -194,6 +199,11 @@ [super dealloc]; } +-(void) cleanup { + [self dismissPopover]; + [self.view removeFromSuperview]; +} + #pragma mark - #pragma mark Overlay actions and members // nice transition for dimming, should be called only by the timer himself @@ -569,19 +579,23 @@ // called by uStore from AddProgress void startSpinning() { setGameRunning(NO); - CGRect screen = [[UIScreen mainScreen] bounds]; + UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow]; UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - indicator.tag = 987654; - indicator.center = CGPointMake(screen.size.width/2 - 118, screen.size.height/2); + indicator.tag = ACTIVITYINDICATOR_TAG; + if ([[UIScreen screens] count] > 1) + indicator.center = CGPointMake(theWindow.frame.size.width/2, theWindow.frame.size.height/2 + 118); + else + indicator.center = CGPointMake(theWindow.frame.size.width/2 + 118, theWindow.frame.size.height/2); indicator.hidesWhenStopped = YES; [indicator startAnimating]; - [[[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG] addSubview:indicator]; + [theWindow addSubview:indicator]; [indicator release]; } // called by uStore from FinishProgress and by OverlayViewController by replayBegan void stopSpinning() { - UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[[[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG] viewWithTag:987654]; + UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow]; + UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[theWindow viewWithTag:ACTIVITYINDICATOR_TAG]; [indicator stopAnimating]; HW_zoomSet(1.7); if (isReplay == NO) @@ -590,7 +604,7 @@ // called by CCHandlers from chNextTurn void clearView() { - UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow]; + UIWindow *theWindow = ([[UIScreen screens] count] == 1) ? [[UIApplication sharedApplication] keyWindow] : [SDLUIKitDelegate sharedAppDelegate].uiwindow; UIButton *theButton = (UIButton *)[theWindow viewWithTag:CONFIRMATION_TAG]; UISegmentedControl *theSegment = (UISegmentedControl *)[theWindow viewWithTag:GRENADE_TAG]; @@ -600,8 +614,8 @@ theSegment.alpha = 0; [UIView commitAnimations]; - [theWindow performSelector:@selector(removeFromSuperview) withObject:theButton afterDelay:0.3]; - [theWindow performSelector:@selector(removeFromSuperview) withObject:theSegment afterDelay:0.3]; + [theWindow performSelector:@selector(removeFromSuperview) withObject:theButton afterDelay:ANIMATION_DURATION]; + [theWindow performSelector:@selector(removeFromSuperview) withObject:theSegment afterDelay:ANIMATION_DURATION]; cachedGrenadeTime = 2; } @@ -612,7 +626,7 @@ UIView *blackView = [[UIView alloc] initWithFrame:theWindow.frame]; blackView.backgroundColor = [UIColor blackColor]; blackView.alpha = 0.6; - blackView.tag = BLACKVIEW_TAG; + blackView.tag = REPLAYBLACKVIEW_TAG; blackView.exclusiveTouch = NO; blackView.multipleTouchEnabled = NO; blackView.userInteractionEnabled = NO; @@ -630,7 +644,7 @@ // called by uGame void replayFinished() { UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow]; - UIView *blackView = (UIView *)[theWindow viewWithTag:BLACKVIEW_TAG]; + UIView *blackView = (UIView *)[theWindow viewWithTag:REPLAYBLACKVIEW_TAG]; [UIView beginAnimations:@"removing black" context:NULL]; [UIView setAnimationDuration:1]; diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h Sat Oct 02 04:23:32 2010 +0200 @@ -21,17 +21,19 @@ */ #import -#import "SDL_uikitopenglview.h" @class MainMenuViewController; -@class OverlayViewController; @interface SDLUIKitDelegate:NSObject { MainMenuViewController *mainViewController; + UIWindow *uiwindow; + UIWindow *secondWindow; BOOL isInGame; } @property (nonatomic,retain) MainMenuViewController *mainViewController; +@property (nonatomic,retain) UIWindow *uiwindow; +@property (nonatomic,retain) UIWindow *secondWindow; +(SDLUIKitDelegate *)sharedAppDelegate; -(void) startSDLgame:(NSDictionary *)gameDictionary; diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Sat Oct 02 04:23:32 2010 +0200 @@ -39,6 +39,8 @@ #undef main #endif +#define BLACKVIEW_TAG 17935 +#define SECONDBLACKVIEW_TAG 48620 #define VALGRIND "/opt/valgrind/bin/valgrind" int main (int argc, char *argv[]) { @@ -56,7 +58,7 @@ } @implementation SDLUIKitDelegate -@synthesize mainViewController; +@synthesize mainViewController, uiwindow, secondWindow; // convenience method +(SDLUIKitDelegate *)sharedAppDelegate { @@ -67,6 +69,8 @@ -(id) init { if (self = [super init]){ mainViewController = nil; + uiwindow = nil; + secondWindow = nil; isInGame = NO; } return self; @@ -74,17 +78,38 @@ -(void) dealloc { [mainViewController release]; + [uiwindow release]; + [secondWindow release]; [super dealloc]; } // main routine for calling the actual game engine -(void) startSDLgame:(NSDictionary *)gameDictionary { - UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0]; - - UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aWin.frame.size.width, aWin.frame.size.height)]; + UIWindow *gameWindow; + if ([[UIScreen screens] count] > 1) + gameWindow = self.secondWindow; + else + gameWindow = self.uiwindow; + UIView *blackView = [[UIView alloc] initWithFrame:gameWindow.frame]; + blackView.backgroundColor = [UIColor blackColor]; blackView.opaque = YES; - blackView.backgroundColor = [UIColor blackColor]; - [aWin addSubview:blackView]; + blackView.tag = BLACKVIEW_TAG; + [gameWindow addSubview:blackView]; + [blackView release]; + + if ([[UIScreen screens] count] > 1) { + UIView *secondBlackView = [[UIView alloc] initWithFrame:self.uiwindow.frame]; + secondBlackView.backgroundColor = [UIColor blackColor]; + secondBlackView.opaque = YES; + secondBlackView.tag = SECONDBLACKVIEW_TAG; + secondBlackView.alpha = 0; + [self.uiwindow addSubview:secondBlackView]; + [UIView beginAnimations:@"fading to game" context:NULL]; + [UIView setAnimationDuration:1]; + secondBlackView.alpha = 1; + [UIView commitAnimations]; + [secondBlackView release]; + } // pull out useful configuration info from various files GameSetup *setup = [[GameSetup alloc] initWithDictionary:gameDictionary]; @@ -104,21 +129,29 @@ isInGame = NO; free(gameArgs); - [aWin makeKeyAndVisible]; + [uiwindow makeKeyAndVisible]; + + UIView *refBlackView = [gameWindow viewWithTag:BLACKVIEW_TAG]; + UIView *refSecondBlackView = [self.uiwindow viewWithTag:SECONDBLACKVIEW_TAG]; [UIView beginAnimations:@"fading in from ingame" context:NULL]; [UIView setAnimationDuration:1]; - blackView.alpha = 0; + refBlackView.alpha = 0; + refSecondBlackView.alpha = 0; [UIView commitAnimations]; - [blackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; - [blackView performSelector:@selector(release) withObject:nil afterDelay:1]; + [refBlackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; + [refSecondBlackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; } +// overlay with controls, become visible later, with a transparency effect -(void) displayOverlayLater:(NSNumber *)isNetGame { - // overlay with controls, become visible later, with a transparency effect OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; - // keyWindow is the frontmost window - [[[UIApplication sharedApplication] keyWindow] addSubview:overlayController.view]; + UIWindow *gameWindow; + if ([[UIScreen screens] count] > 1) + gameWindow = self.uiwindow; + else + gameWindow = [[UIApplication sharedApplication] keyWindow]; + [gameWindow addSubview:overlayController.view]; [overlayController release]; } @@ -126,18 +159,41 @@ -(void) applicationDidFinishLaunching:(UIApplication *)application { [application setStatusBarHidden:YES]; - UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil]; else self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil]; - [uiwindow addSubview:self.mainViewController.view]; + [self.uiwindow addSubview:self.mainViewController.view]; [self.mainViewController release]; - uiwindow.backgroundColor = [UIColor blackColor]; - [uiwindow makeKeyAndVisible]; + self.uiwindow.backgroundColor = [UIColor blackColor]; + [self.uiwindow makeKeyAndVisible]; + if ([[UIScreen screens]count] > 1) { + /* + CGSize maxSize = CGSizeZero; + UIScreenMode *screenMode = nil; + for (UIScreenMode *mode in [[[UIScreen screens] objectAtIndex:1] availableModes]) { + if (mode.size.width > maxSize.width) { + maxSize = mode.size; + screenMode = mode; + } + } + */ + DLog(@"dual head mode ftw"); + self.secondWindow = [[UIWindow alloc] initWithFrame:[[[UIScreen screens] objectAtIndex:1] bounds]]; + self.secondWindow.backgroundColor = [UIColor blackColor]; + self.secondWindow.screen = [[UIScreen screens] objectAtIndex:1]; + UIImage *titleImage = [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"title.png"]]; + UIImageView *titleView = [[UIImageView alloc] initWithImage:titleImage]; + titleView.center = self.secondWindow.center; + [self.secondWindow addSubview:titleView]; + [titleView release]; + [self.secondWindow makeKeyAndVisible]; + } + // set working directory to resource path [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; } diff -r 022dfe1431b7 -r 44804043b691 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Oct 01 13:56:11 2010 -0400 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Oct 02 04:23:32 2010 +0200 @@ -2333,8 +2333,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; 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/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/events\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/video\"/**", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_mixer/\"", @@ -2426,8 +2426,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; 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/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/events\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/video\"/**", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_mixer/\"", @@ -2520,8 +2520,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; 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/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/events\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/video\"/**", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_mixer/\"", @@ -2652,8 +2652,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; 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/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/events\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/video\"/**", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_mixer/\"", @@ -2695,8 +2695,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; 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/src/\"/**", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/events\"", + "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/src/video\"/**", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL_mixer/\"",