cocoaTouch/SDLOverrides/SDL_uikitview.m
changeset 2772 1965eba10be6
parent 2754 ad4f81fbfb76
child 2805 36a8cebb91e8
equal deleted inserted replaced
2771:477957a89881 2772:1965eba10be6
    18  
    18  
    19  Sam Lantinga, mods for Hedgewars by Vittorio Giovara
    19  Sam Lantinga, mods for Hedgewars by Vittorio Giovara
    20  slouken@libsdl.org, vittorio.giovara@gmail.com
    20  slouken@libsdl.org, vittorio.giovara@gmail.com
    21  */
    21  */
    22 
    22 
    23 #include "PascalImports.h"
    23 #import "PascalImports.h"
       
    24 #import "CGPointUtils.h"
    24 #import "SDL_uikitview.h"
    25 #import "SDL_uikitview.h"
    25 #import "SDL_uikitappdelegate.h"
    26 #import "SDL_uikitappdelegate.h"
    26 
    27 
    27 #if SDL_IPHONE_KEYBOARD
    28 #if SDL_IPHONE_KEYBOARD
    28 #import "SDL_keyboard_c.h"
    29 #import "SDL_keyboard_c.h"
    62 		mice[i].driverdata = NULL;
    63 		mice[i].driverdata = NULL;
    63 		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
    64 		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
    64 	}
    65 	}
    65 
    66 
    66 	self.multipleTouchEnabled = YES;
    67 	self.multipleTouchEnabled = YES;
    67 
    68 	self.exclusiveTouch = YES;
       
    69 /*
    68 	// custom code
    70 	// custom code
    69 	// the coordinate system is still like in Portrait even though everything is rotated
    71 	// the coordinate system is still like in Portrait even though everything is rotated
    70 	attackButton = [[UIButton alloc] initWithFrame:CGRectMake(30, 480, 260, 50)];
    72 	attackButton = [[UIButton alloc] initWithFrame:CGRectMake(30, 480, 260, 50)];
    71 	[attackButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
    73 	[attackButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
    72 	[attackButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateHighlighted];
    74 	[attackButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateHighlighted];
   107 	//dummy button used to test chat
   109 	//dummy button used to test chat
   108 	UIButton *chatButton = [[UIButton alloc] initWithFrame:CGRectMake(70, 100, 250, 280)];
   110 	UIButton *chatButton = [[UIButton alloc] initWithFrame:CGRectMake(70, 100, 250, 280)];
   109 	[chatButton addTarget:[self superclass] action:@selector(chatBegin) forControlEvents:UIControlEventTouchDown];
   111 	[chatButton addTarget:[self superclass] action:@selector(chatBegin) forControlEvents:UIControlEventTouchDown];
   110 	[self insertSubview:chatButton atIndex:0];
   112 	[self insertSubview:chatButton atIndex:0];
   111 	[chatButton release];
   113 	[chatButton release];
   112 	
   114 	*/
   113 	return self;
   115 	return self;
   114 }
   116 }
   115 
   117 
   116 #pragma mark -
   118 #pragma mark -
   117 #pragma mark Exported functions for FreePascal
   119 #pragma mark Exported functions for FreePascal
   121 	return [documentsDirectory UTF8String];
   123 	return [documentsDirectory UTF8String];
   122 }
   124 }
   123 
   125 
   124 void IPH_showControls (void) {
   126 void IPH_showControls (void) {
   125 	NSLog(@"Showing controls");
   127 	NSLog(@"Showing controls");
       
   128 	/*
   126 	[UIView beginAnimations:nil context:NULL];
   129 	[UIView beginAnimations:nil context:NULL];
   127 	[UIView setAnimationDuration:0.5];
   130 	[UIView setAnimationDuration:0.5];
   128 	attackButton.frame = CGRectMake(30, 430, 260, 50);
   131 	attackButton.frame = CGRectMake(30, 430, 260, 50);
   129 	menuButton.frame = CGRectMake(0, 430, 30, 50);
   132 	menuButton.frame = CGRectMake(0, 430, 30, 50);
   130 	[UIView commitAnimations];
   133 	[UIView commitAnimations];
       
   134 	 */
   131 }
   135 }
   132 
   136 
   133 #pragma mark -
   137 #pragma mark -
   134 #pragma mark Superclass methods to call Pascal code
   138 #pragma mark Superclass methods to call Pascal code
   135 +(void) attackButtonPressed {
   139 +(void) attackButtonPressed {
   155 +(void) movingDown {
   159 +(void) movingDown {
   156 	HW_aimDown();
   160 	HW_aimDown();
   157 }
   161 }
   158 
   162 
   159 +(void) chatBegin {
   163 +(void) chatBegin {
   160 	HW_chat();
   164 	//TODO: implement a UITextScroll and put received chat lines in there
   161 	SDL_iPhoneKeyboardShow([SDLUIKitDelegate sharedAppDelegate].uiwindow);
       
   162 }
   165 }
   163 
   166 
   164 #pragma mark -
   167 #pragma mark -
   165 #pragma mark Custom SDL_UIView input handling
   168 #pragma mark Custom SDL_UIView input handling
   166 #define kMinimumPinchDelta	50
   169 #define kMinimumPinchDelta	50
   167 #define kMinimumGestureLength	10
   170 #define kMinimumGestureLength	10
   168 #define kMaximumVariance	3
   171 #define kMaximumVariance	3
   169 
   172 
   170 // we override default touch input to implement our own gestures
   173 // we override default touch input to implement our own gestures
   171 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   174 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   172 	/*
   175 	NSArray *twoTouches;
   173 	NSEnumerator *enumerator = [touches objectEnumerator];
       
   174 	UITouch *touch =(UITouch*)[enumerator nextObject];
       
   175 	
       
   176 	// associate touches with mice, so long as we have slots 
       
   177 	int i;
       
   178 	int found = 0;
       
   179 	for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
       
   180 	
       
   181 		// check if this mouse is already tracking a touch 
       
   182 		if (mice[i].driverdata != NULL) {
       
   183 			continue;
       
   184 		}
       
   185 			
       
   186 		// mouse not associated with anything right now, associate the touch with this mouse
       
   187 		found = 1;
       
   188 		
       
   189 		// save old mouse so we can switch back 
       
   190 		int oldMouse = SDL_SelectMouse(-1);
       
   191 		
       
   192 		// select this slot's mouse 
       
   193 		SDL_SelectMouse(i);
       
   194 		CGPoint locationInView = [touch locationInView: self];
       
   195 		
       
   196 		CGFloat oldX = locationInView.x;
       
   197 		locationInView.x = locationInView.y;
       
   198 		locationInView.y = 320 - oldX;
       
   199 		
       
   200 		// set driver data to touch object, we'll use touch object later 
       
   201 		mice[i].driverdata = [touch retain];
       
   202 		
       
   203 		// send moved event 
       
   204 		SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
       
   205 		
       
   206 		// send mouse down event 
       
   207 		SDL_SendMouseButton(i, SDL_PRESSED, SDL_BUTTON_LEFT);
       
   208 		
       
   209 		// re-calibrate relative mouse motion 
       
   210 		SDL_GetRelativeMouseState(i, NULL, NULL);
       
   211 		
       
   212 		// grab next touch 
       
   213 		touch = (UITouch*)[enumerator nextObject]; 
       
   214 		
       
   215 		// switch back to our old mouse 
       
   216 		SDL_SelectMouse(oldMouse);
       
   217 		
       
   218 	}
       
   219 	*/
       
   220 	
       
   221 	UITouch *touch = [touches anyObject];
   176 	UITouch *touch = [touches anyObject];
   222 	
   177 	
   223 	switch ([touches count]) {
   178 	switch ([touches count]) {
   224 		case 1:
   179 		case 1:
   225 			gestureStartPoint = [touch locationInView:self];
   180 			gestureStartPoint = [touch locationInView:self];
   226 			initialDistanceForPinching = 0;
   181 			initialDistanceForPinching = 0;
   227 			switch ([touch tapCount]) {
   182 			switch ([touch tapCount]) {
   228 				case 1:
   183 				case 1:
   229 					NSLog(@"X:%d Y:%d", (int) gestureStartPoint.x, gestureStartPoint.y );
   184 					
       
   185 					NSLog(@"X:%d Y:%d", (int)gestureStartPoint.x, (int)gestureStartPoint.y );
   230 					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   186 					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   231 							      (int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   187 							      (int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   232 					HW_click();
   188 					HW_click();
   233 					break;
   189 					break;
   234 				case 2:
   190 				case 2:
   242 			if (2 == [touch tapCount]) {
   198 			if (2 == [touch tapCount]) {
   243 				HW_zoomReset();
   199 				HW_zoomReset();
   244 			}
   200 			}
   245 			
   201 			
   246 			// pinching
   202 			// pinching
   247 			NSArray *twoTouches = [touches allObjects];
   203 			twoTouches = [touches allObjects];
   248 			UITouch *first = [twoTouches objectAtIndex:0];
   204 			UITouch *first = [twoTouches objectAtIndex:0];
   249 			UITouch *second = [twoTouches objectAtIndex:1];
   205 			UITouch *second = [twoTouches objectAtIndex:1];
   250 			initialDistanceForPinching = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
   206 			initialDistanceForPinching = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
   251 			break;
   207 			break;
   252 		default:
   208 		default:
   255 
   211 
   256 }
   212 }
   257 
   213 
   258 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   214 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   259 	initialDistanceForPinching = 0;
   215 	initialDistanceForPinching = 0;
   260 	
   216 	gestureStartPoint.x = 0;
       
   217 	gestureStartPoint.y = 0;
   261 	HW_allKeysUp();
   218 	HW_allKeysUp();
   262 	/*
       
   263 	NSEnumerator *enumerator = [touches objectEnumerator];
       
   264 	UITouch *touch=nil;
       
   265 	
       
   266 	while(touch = (UITouch *)[enumerator nextObject]) {
       
   267 		// search for the mouse slot associated with this touch 
       
   268 		int i, found = NO;
       
   269 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
       
   270 			if (mice[i].driverdata == touch) {
       
   271 				// found the mouse associate with the touch 
       
   272 				[(UITouch*)(mice[i].driverdata) release];
       
   273 				mice[i].driverdata = NULL;
       
   274 				// send mouse up 
       
   275 				SDL_SendMouseButton(i, SDL_RELEASED, SDL_BUTTON_LEFT);
       
   276 				// discontinue search for this touch 
       
   277 				found = YES;
       
   278 			}
       
   279 		}
       
   280 	}
       
   281 	*/
       
   282 }
   219 }
   283 
   220 
   284 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   221 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   285 	// this can happen if the user puts more than 5 touches on the screen
   222 	// this can happen if the user puts more than 5 touches on the screen at once, or perhaps in other circumstances.
   286 	// at once, or perhaps in other circumstances.  Usually (it seems)
   223 	// Usually (it seems) all active touches are canceled.
   287 	// all active touches are canceled.
       
   288 	[self touchesEnded:touches withEvent:event];
   224 	[self touchesEnded:touches withEvent:event];
   289 }
   225 }
   290 
   226 
   291 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   227 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   292 	NSArray *twoTouches;
   228 	NSArray *twoTouches;
   299 			// panning
   235 			// panning
   300 			SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   236 			SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   301 							(int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   237 							(int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   302 			// remember that we have x and y inverted
   238 			// remember that we have x and y inverted
   303 			/* temporarily disabling hog movements for camera panning testing
   239 			/* temporarily disabling hog movements for camera panning testing
   304 			 CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
   240 			CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
   305 			CGFloat horizDiff = gestureStartPoint.y - currentPosition.y;
   241 			CGFloat horizDiff = gestureStartPoint.y - currentPosition.y;
   306 			CGFloat deltaX = fabsf(vertDiff);
   242 			CGFloat deltaX = fabsf(vertDiff);
   307 			CGFloat deltaY = fabsf(horizDiff);
   243 			CGFloat deltaY = fabsf(horizDiff);
   308 			
   244 			
   309 			if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance) {
   245 			if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance) {
   334 			currentDistanceOfPinching = initialDistanceForPinching;
   270 			currentDistanceOfPinching = initialDistanceForPinching;
   335 			break;
   271 			break;
   336 		default:
   272 		default:
   337 			break;
   273 			break;
   338 	}
   274 	}
   339 	
   275 }
   340 	/*
   276 
   341 	NSEnumerator *enumerator = [touches objectEnumerator];
   277 /*
   342 	 UITouch *touch=nil;while(touch = (UITouch *)[enumerator nextObject]) {
       
   343 		// try to find the mouse associated with this touch 
       
   344 		int i, found = NO;
       
   345 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
       
   346 			if (mice[i].driverdata == touch) {
       
   347 				// found proper mouse 
       
   348 				CGPoint locationInView = [touch locationInView: self];
       
   349 				// send moved event 
       
   350 				SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
       
   351 				// discontinue search 
       
   352 				found = YES;
       
   353 			}
       
   354 		}
       
   355 	}
       
   356 	*/
       
   357 }
       
   358 
       
   359 #pragma mark -
   278 #pragma mark -
   360 #pragma mark default routines
   279 #pragma mark Keyboard related functionality
   361 /*
       
   362 	---- Keyboard related functionality below this line ----
       
   363 */
       
   364 #if SDL_IPHONE_KEYBOARD
   280 #if SDL_IPHONE_KEYBOARD
   365 
   281 // Is the iPhone virtual keyboard visible onscreen? 
   366 /* Is the iPhone virtual keyboard visible onscreen? */
       
   367 - (BOOL)keyboardVisible {
   282 - (BOOL)keyboardVisible {
   368 	return keyboardVisible;
   283 	return keyboardVisible;
   369 }
   284 }
   370 
   285 
   371 /* Set ourselves up as a UITextFieldDelegate */
   286 // Set ourselves up as a UITextFieldDelegate
   372 - (void)initializeKeyboard {
   287 - (void)initializeKeyboard {
   373 		
   288 		
   374 	textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
   289 	textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
   375 	textField.delegate = self;
   290 	textField.delegate = self;
   376 	/* placeholder so there is something to delete! */
   291 	// placeholder so there is something to delete!
   377 	textField.text = @" ";	
   292 	textField.text = @" ";	
   378 	
   293 	
   379 	/* set UITextInputTrait properties, mostly to defaults */
   294 	// set UITextInputTrait properties, mostly to defaults
   380 	textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
   295 	textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
   381 	textField.autocorrectionType = UITextAutocorrectionTypeNo;
   296 	textField.autocorrectionType = UITextAutocorrectionTypeNo;
   382 	textField.enablesReturnKeyAutomatically = NO;
   297 	textField.enablesReturnKeyAutomatically = NO;
   383 	textField.keyboardAppearance = UIKeyboardAppearanceDefault;
   298 	textField.keyboardAppearance = UIKeyboardAppearanceDefault;
   384 	textField.keyboardType = UIKeyboardTypeDefault;
   299 	textField.keyboardType = UIKeyboardTypeDefault;
   385 	textField.returnKeyType = UIReturnKeyDefault;
   300 	textField.returnKeyType = UIReturnKeyDefault;
   386 	textField.secureTextEntry = NO;	
   301 	textField.secureTextEntry = NO;	
   387 	
   302 	
   388 	textField.hidden = YES;
   303 	textField.hidden = YES;
   389 	keyboardVisible = NO;
   304 	keyboardVisible = NO;
   390 	/* add the UITextField (hidden) to our view */
   305 	// add the UITextField (hidden) to our view
   391 	[self addSubview: textField];
   306 	[self addSubview: textField];
   392 	
   307 	
   393 	/* create our SDL_Keyboard */
   308 	// create our SDL_Keyboard
   394 	SDL_Keyboard keyboard;
   309 	SDL_Keyboard keyboard;
   395 	SDL_zero(keyboard);
   310 	SDL_zero(keyboard);
   396 	SDL_AddKeyboard(&keyboard, 0);
   311 	SDL_AddKeyboard(&keyboard, 0);
   397 	SDLKey keymap[SDL_NUM_SCANCODES];
   312 	SDLKey keymap[SDL_NUM_SCANCODES];
   398 	SDL_GetDefaultKeymap(keymap);
   313 	SDL_GetDefaultKeymap(keymap);
   399 	SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
   314 	SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
   400 	
   315 	
   401 }
   316 }
   402 
   317 
   403 /* reveal onscreen virtual keyboard */
   318 // reveal onscreen virtual keyboard
   404 - (void)showKeyboard {
   319 - (void)showKeyboard {
   405 	keyboardVisible = YES;
   320 	keyboardVisible = YES;
   406 	[textField becomeFirstResponder];
   321 	[textField becomeFirstResponder];
   407 }
   322 }
   408 
   323 
   409 /* hide onscreen virtual keyboard */
   324 // hide onscreen virtual keyboard
   410 - (void)hideKeyboard {
   325 - (void)hideKeyboard {
   411 	keyboardVisible = NO;
   326 	keyboardVisible = NO;
   412 	[textField resignFirstResponder];
   327 	[textField resignFirstResponder];
   413 }
   328 }
   414 
   329 
   415 /* UITextFieldDelegate method.  Invoked when user types something. */
   330 // UITextFieldDelegate method.  Invoked when user types something.
   416 - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
   331 - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
   417 	
   332 	
   418 	if ([string length] == 0) {
   333 	if ([string length] == 0) {
   419 		/* it wants to replace text with nothing, ie a delete */
   334 		// it wants to replace text with nothing, ie a delete
   420 		SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE);
   335 		SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE);
   421 		SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE);
   336 		SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE);
   422 	}
   337 	}
   423 	else {
   338 	else {
   424 		/* go through all the characters in the string we've been sent
   339 		// go through all the characters in the string we've been sent and convert them to key presses
   425 		   and convert them to key presses */
       
   426 		int i;
   340 		int i;
   427 		for (i=0; i<[string length]; i++) {
   341 		for (i=0; i<[string length]; i++) {
   428 			
   342 			
   429 			unichar c = [string characterAtIndex: i];
   343 			unichar c = [string characterAtIndex: i];
   430 			
   344 			
   431 			Uint16 mod = 0;
   345 			Uint16 mod = 0;
   432 			SDL_scancode code;
   346 			SDL_scancode code;
   433 			
   347 			
   434 			if (c < 127) {
   348 			if (c < 127) {
   435 				/* figure out the SDL_scancode and SDL_keymod for this unichar */
   349 				// figure out the SDL_scancode and SDL_keymod for this unichar
   436 				code = unicharToUIKeyInfoTable[c].code;
   350 				code = unicharToUIKeyInfoTable[c].code;
   437 				mod  = unicharToUIKeyInfoTable[c].mod;
   351 				mod  = unicharToUIKeyInfoTable[c].mod;
   438 			}
   352 			}
   439 			else {
   353 			else {
   440 				/* we only deal with ASCII right now */
   354 				// we only deal with ASCII right now
   441 				code = SDL_SCANCODE_UNKNOWN;
   355 				code = SDL_SCANCODE_UNKNOWN;
   442 				mod = 0;
   356 				mod = 0;
   443 			}
   357 			}
   444 			
   358 			
   445 			if (mod & KMOD_SHIFT) {
   359 			if (mod & KMOD_SHIFT) {
   446 				/* If character uses shift, press shift down */
   360 				// If character uses shift, press shift down
   447 				SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT);
   361 				SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT);
   448 			}
   362 			}
   449 			/* send a keydown and keyup even for the character */
   363 			// send a keydown and keyup even for the character
   450 			SDL_SendKeyboardKey( 0, SDL_PRESSED, code);
   364 			SDL_SendKeyboardKey( 0, SDL_PRESSED, code);
   451 			SDL_SendKeyboardKey( 0, SDL_RELEASED, code);
   365 			SDL_SendKeyboardKey( 0, SDL_RELEASED, code);
   452 			if (mod & KMOD_SHIFT) {
   366 			if (mod & KMOD_SHIFT) {
   453 				/* If character uses shift, press shift back up */
   367 				// If character uses shift, press shift back up
   454 				SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT);
   368 				SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT);
   455 			}			
   369 			}			
   456 		}
   370 		}
   457 	}
   371 	}
   458 	return NO; /* don't allow the edit! (keep placeholder text there) */
   372 	return NO; // don't allow the edit! (keep placeholder text there)
   459 }
   373 }
   460 
   374 
   461 /* Terminates the editing session */
   375 // Terminates the editing session
   462 - (BOOL)textFieldShouldReturn:(UITextField*)_textField {
   376 - (BOOL)textFieldShouldReturn:(UITextField*)_textField {
   463 	[self hideKeyboard];
   377 	[self hideKeyboard];
   464 	return YES;
   378 	return YES;
   465 }
   379 }
   466 
   380 
   467 #endif
   381 #endif
   468 
   382 */
   469 @end
   383 @end
   470 
   384 /*
   471 /* iPhone keyboard addition functions */
   385 // iPhone keyboard addition functions
   472 #if SDL_IPHONE_KEYBOARD
   386 #if SDL_IPHONE_KEYBOARD
   473 
   387 
   474 int SDL_iPhoneKeyboardShow(SDL_Window *window) {
   388 int SDL_iPhoneKeyboardShow(SDL_Window *window) {
   475 	SDL_WindowData *data;
   389 	SDL_WindowData *data;
   476 	SDL_uikitview *view;
   390 	SDL_uikitview *view;
   563 	}
   477 	}
   564 }
   478 }
   565 
   479 
   566 #else
   480 #else
   567 
   481 
   568 /* stubs, used if compiled without keyboard support */
   482 // stubs, used if compiled without keyboard support
   569 
   483 
   570 int SDL_iPhoneKeyboardShow(SDL_Window *window) {
   484 int SDL_iPhoneKeyboardShow(SDL_Window *window) {
   571 	SDL_SetError("Not compiled with keyboard support");
   485 	SDL_SetError("Not compiled with keyboard support");
   572 	return -1;
   486 	return -1;
   573 }
   487 }
   584 int SDL_iPhoneKeyboardToggle(SDL_Window *window) {
   498 int SDL_iPhoneKeyboardToggle(SDL_Window *window) {
   585 	SDL_SetError("Not compiled with keyboard support");
   499 	SDL_SetError("Not compiled with keyboard support");
   586 	return -1;
   500 	return -1;
   587 }
   501 }
   588 
   502 
   589 
       
   590 #endif /* SDL_IPHONE_KEYBOARD */
   503 #endif /* SDL_IPHONE_KEYBOARD */