2688
|
1 |
/*
|
|
2 |
SDL - Simple DirectMedia Layer
|
|
3 |
Copyright (C) 1997-2009 Sam Lantinga
|
|
4 |
|
|
5 |
This library is free software; you can redistribute it and/or
|
|
6 |
modify it under the terms of the GNU Lesser General Public
|
|
7 |
License as published by the Free Software Foundation; either
|
|
8 |
version 2.1 of the License, or (at your option) any later version.
|
|
9 |
|
|
10 |
This library is distributed in the hope that it will be useful,
|
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 |
Lesser General Public License for more details.
|
|
14 |
|
|
15 |
You should have received a copy of the GNU Lesser General Public
|
|
16 |
License along with this library; if not, write to the Free Software
|
|
17 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
|
|
19 |
Sam Lantinga, mods for Hedgewars by Vittorio Giovara
|
|
20 |
slouken@libsdl.org, vittorio.giovara@gmail.com
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include "PascalImports.h"
|
|
24 |
#import "SDL_uikitview.h"
|
|
25 |
#import "SDL_uikitappdelegate.h"
|
|
26 |
|
|
27 |
#if SDL_IPHONE_KEYBOARD
|
|
28 |
#import "SDL_keyboard_c.h"
|
|
29 |
#import "keyinfotable.h"
|
|
30 |
#import "SDL_uikitwindow.h"
|
|
31 |
#endif
|
|
32 |
|
|
33 |
@implementation SDL_uikitview
|
|
34 |
|
|
35 |
@synthesize initialDistance, gestureStartPoint;
|
|
36 |
|
2689
|
37 |
// they have to be global variables to allow showControls() to use them
|
|
38 |
UIButton *attackButton, *menuButton;
|
|
39 |
|
2688
|
40 |
- (void)dealloc {
|
|
41 |
#if SDL_IPHONE_KEYBOARD
|
|
42 |
SDL_DelKeyboard(0);
|
|
43 |
[textField release];
|
|
44 |
#endif
|
2689
|
45 |
[menuButton release];
|
|
46 |
[attackButton release];
|
2688
|
47 |
[super dealloc];
|
|
48 |
}
|
|
49 |
|
|
50 |
- (id)initWithFrame:(CGRect)frame {
|
2689
|
51 |
// the addTarget parameter for the buttons below is set like that because
|
|
52 |
// this object is inherited by SDL_openglesview.m which is the one allocated by SDL.
|
|
53 |
// We select this class with [self superclass] and call the selectors with "+" because
|
|
54 |
// they are superclass methods
|
2688
|
55 |
self = [super initWithFrame: frame];
|
|
56 |
|
|
57 |
#if SDL_IPHONE_KEYBOARD
|
|
58 |
[self initializeKeyboard];
|
|
59 |
#endif
|
|
60 |
|
|
61 |
int i;
|
|
62 |
for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
|
|
63 |
mice[i].id = i;
|
|
64 |
mice[i].driverdata = NULL;
|
|
65 |
SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
|
|
66 |
}
|
|
67 |
|
2689
|
68 |
attackButton = [[UIButton alloc] initWithFrame:CGRectMake(30, 480, 260,50)];
|
2688
|
69 |
[attackButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
|
|
70 |
[attackButton addTarget:[self superclass] action:@selector(attackButtonPressed) forControlEvents:UIControlEventTouchDown];
|
|
71 |
[attackButton addTarget:[self superclass] action:@selector(attackButtonReleased) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside];
|
2689
|
72 |
[self addSubview:attackButton];
|
|
73 |
|
|
74 |
menuButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 480, 30,50)];
|
|
75 |
[menuButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
|
|
76 |
[menuButton addTarget:[self superclass] action:@selector(attackButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
|
77 |
[self addSubview:menuButton];
|
2688
|
78 |
|
|
79 |
self.multipleTouchEnabled = YES;
|
2689
|
80 |
|
2688
|
81 |
return self;
|
|
82 |
}
|
|
83 |
|
|
84 |
#pragma mark -
|
2690
|
85 |
#pragma mark Exported functions for FreePascal
|
2689
|
86 |
|
2690
|
87 |
const char* IPH_getDocumentsPath() {
|
|
88 |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
89 |
NSString *documentsDirectory = [paths objectAtIndex: 0];
|
|
90 |
return [documentsDirectory UTF8String];
|
|
91 |
}
|
|
92 |
|
|
93 |
void IPH_showControls (void) {
|
2689
|
94 |
NSLog(@"Showing controls");
|
|
95 |
[UIView beginAnimations:nil context:NULL];
|
|
96 |
[UIView setAnimationDuration:0.5];
|
|
97 |
attackButton.frame = CGRectMake(30, 430, 260, 50);
|
|
98 |
menuButton.frame = CGRectMake(0, 430, 30, 50);
|
|
99 |
[UIView commitAnimations];
|
|
100 |
}
|
|
101 |
|
|
102 |
#pragma mark -
|
2688
|
103 |
#pragma mark Superclass methods
|
2689
|
104 |
|
2688
|
105 |
+(void) attackButtonPressed {
|
|
106 |
HW_shoot();
|
|
107 |
}
|
|
108 |
|
|
109 |
+(void) attackButtonReleased {
|
|
110 |
HW_allKeysUp();
|
|
111 |
}
|
|
112 |
|
|
113 |
#pragma mark -
|
|
114 |
#pragma mark Custom SDL_UIView input handling
|
|
115 |
|
|
116 |
// we override default touch input to implement our own gestures
|
|
117 |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
|
118 |
/*NSEnumerator *enumerator = [touches objectEnumerator];
|
|
119 |
UITouch *touch =(UITouch*)[enumerator nextObject];
|
|
120 |
|
|
121 |
/* associate touches with mice, so long as we have slots
|
|
122 |
int i;
|
|
123 |
int found = 0;
|
|
124 |
for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
|
|
125 |
|
|
126 |
/* check if this mouse is already tracking a touch
|
|
127 |
if (mice[i].driverdata != NULL) {
|
|
128 |
continue;
|
|
129 |
}
|
|
130 |
/*
|
|
131 |
mouse not associated with anything right now,
|
|
132 |
associate the touch with this mouse
|
|
133 |
|
|
134 |
found = 1;
|
|
135 |
|
|
136 |
/* save old mouse so we can switch back
|
|
137 |
int oldMouse = SDL_SelectMouse(-1);
|
|
138 |
|
|
139 |
/* select this slot's mouse
|
|
140 |
SDL_SelectMouse(i);
|
|
141 |
CGPoint locationInView = [touch locationInView: self];
|
|
142 |
|
|
143 |
/* set driver data to touch object, we'll use touch object later
|
|
144 |
mice[i].driverdata = [touch retain];
|
|
145 |
|
|
146 |
/* send moved event
|
|
147 |
SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
|
|
148 |
|
|
149 |
/* send mouse down event
|
|
150 |
SDL_SendMouseButton(i, SDL_PRESSED, SDL_BUTTON_LEFT);
|
|
151 |
|
|
152 |
/* re-calibrate relative mouse motion
|
|
153 |
SDL_GetRelativeMouseState(i, NULL, NULL);
|
|
154 |
|
|
155 |
/* grab next touch
|
|
156 |
touch = (UITouch*)[enumerator nextObject];
|
|
157 |
|
|
158 |
/* switch back to our old mouse
|
|
159 |
SDL_SelectMouse(oldMouse);
|
|
160 |
|
|
161 |
} */
|
|
162 |
|
|
163 |
UITouch *touch = [touches anyObject];
|
|
164 |
gestureStartPoint = [touch locationInView:self];
|
|
165 |
|
|
166 |
// one tap - single click
|
|
167 |
if (1 == [touch tapCount] ) {
|
|
168 |
//SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].windowID, gestureStartPoint.x, gestureStartPoint.y);
|
|
169 |
HW_click();
|
|
170 |
}
|
|
171 |
|
|
172 |
// two taps - right click
|
|
173 |
if (2 == [touch tapCount] ) {
|
|
174 |
HW_ammoMenu();
|
|
175 |
}
|
|
176 |
|
|
177 |
// two taps with two fingers - middle click
|
|
178 |
if (2 == [touch tapCount] && 2 == [touches count]) {
|
|
179 |
HW_zoomReset();
|
|
180 |
}
|
|
181 |
|
|
182 |
// two fingers - begin pinching
|
|
183 |
if (2 == [touches count]) {
|
|
184 |
NSArray *twoTouches = [touches allObjects];
|
|
185 |
UITouch *first = [twoTouches objectAtIndex:0];
|
|
186 |
UITouch *second = [twoTouches objectAtIndex:1];
|
|
187 |
initialDistance = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
|
|
188 |
}
|
|
189 |
}
|
|
190 |
|
|
191 |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
|
192 |
initialDistance = 0;
|
|
193 |
// NSLog(@"touches ended, sigh");
|
|
194 |
|
|
195 |
HW_allKeysUp();
|
|
196 |
/*NSEnumerator *enumerator = [touches objectEnumerator];
|
|
197 |
UITouch *touch=nil;
|
|
198 |
|
|
199 |
while(touch = (UITouch *)[enumerator nextObject]) {
|
|
200 |
/* search for the mouse slot associated with this touch
|
|
201 |
int i, found = NO;
|
|
202 |
for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
|
|
203 |
if (mice[i].driverdata == touch) {
|
|
204 |
/* found the mouse associate with the touch
|
|
205 |
[(UITouch*)(mice[i].driverdata) release];
|
|
206 |
mice[i].driverdata = NULL;
|
|
207 |
/* send mouse up
|
|
208 |
SDL_SendMouseButton(i, SDL_RELEASED, SDL_BUTTON_LEFT);
|
|
209 |
/* discontinue search for this touch
|
|
210 |
found = YES;
|
|
211 |
}
|
|
212 |
}
|
|
213 |
}*/
|
|
214 |
}
|
|
215 |
|
|
216 |
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
|
217 |
/*
|
|
218 |
this can happen if the user puts more than 5 touches on the screen
|
|
219 |
at once, or perhaps in other circumstances. Usually (it seems)
|
|
220 |
all active touches are canceled.
|
|
221 |
*/
|
|
222 |
[self touchesEnded: touches withEvent: event];
|
|
223 |
}
|
|
224 |
|
|
225 |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
|
226 |
UITouch *touch = [touches anyObject];
|
|
227 |
CGPoint currentPosition = [touch locationInView:self];
|
|
228 |
|
|
229 |
CGFloat Xdiff = gestureStartPoint.x - currentPosition.x;
|
|
230 |
CGFloat Ydiff = gestureStartPoint.y - currentPosition.y;
|
|
231 |
CGFloat deltaX = fabsf(Xdiff);
|
|
232 |
CGFloat deltaY = fabsf(Ydiff);
|
|
233 |
|
|
234 |
if (deltaX >= kMinimumGestureLength && deltaY <= kMaximumVariance) {
|
|
235 |
NSLog(@"Horizontal swipe detected, begX:%f curX:%f", gestureStartPoint.x, currentPosition.x);
|
|
236 |
if (Xdiff > 0) HW_walkLeft();
|
|
237 |
else HW_walkRight();
|
|
238 |
}
|
|
239 |
else if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance){
|
|
240 |
NSLog(@"Vertical swipe detected, begY:%f curY:%f", gestureStartPoint.y, currentPosition.y);
|
|
241 |
if (Ydiff > 0) HW_aimUp();
|
|
242 |
else HW_aimDown();
|
|
243 |
}
|
|
244 |
|
|
245 |
// end pinch detection
|
|
246 |
if (2 == [touches count]) {
|
|
247 |
NSArray *twoTouches = [touches allObjects];
|
|
248 |
UITouch *first = [twoTouches objectAtIndex:0];
|
|
249 |
UITouch *second = [twoTouches objectAtIndex:1];
|
|
250 |
CGFloat currentDistance = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
|
|
251 |
|
|
252 |
if (0 == initialDistance)
|
|
253 |
initialDistance = currentDistance;
|
|
254 |
else if (currentDistance - initialDistance > kMinimumPinchDelta) {
|
|
255 |
NSLog(@"Outward pinch detected");
|
|
256 |
HW_zoomOut();
|
|
257 |
}
|
|
258 |
else if (initialDistance - currentDistance > kMinimumPinchDelta) {
|
|
259 |
NSLog(@"Inward pinch detected");
|
|
260 |
HW_zoomIn();
|
|
261 |
}
|
|
262 |
}
|
|
263 |
|
|
264 |
/*NSEnumerator *enumerator = [touches objectEnumerator];
|
|
265 |
UITouch *touch=nil;while(touch = (UITouch *)[enumerator nextObject]) {
|
|
266 |
// try to find the mouse associated with this touch
|
|
267 |
int i, found = NO;
|
|
268 |
for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
|
|
269 |
if (mice[i].driverdata == touch) {
|
|
270 |
// found proper mouse
|
|
271 |
CGPoint locationInView = [touch locationInView: self];
|
|
272 |
// send moved event
|
|
273 |
SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
|
|
274 |
// discontinue search
|
|
275 |
found = YES;
|
|
276 |
}
|
|
277 |
}
|
|
278 |
}*/
|
|
279 |
}
|
|
280 |
|
|
281 |
#pragma mark -
|
|
282 |
#pragma mark default routines
|
|
283 |
/*
|
|
284 |
---- Keyboard related functionality below this line ----
|
|
285 |
*/
|
|
286 |
#if SDL_IPHONE_KEYBOARD
|
|
287 |
|
|
288 |
/* Is the iPhone virtual keyboard visible onscreen? */
|
|
289 |
- (BOOL)keyboardVisible {
|
|
290 |
return keyboardVisible;
|
|
291 |
}
|
|
292 |
|
|
293 |
/* Set ourselves up as a UITextFieldDelegate */
|
|
294 |
- (void)initializeKeyboard {
|
|
295 |
|
|
296 |
textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
|
|
297 |
textField.delegate = self;
|
|
298 |
/* placeholder so there is something to delete! */
|
|
299 |
textField.text = @" ";
|
|
300 |
|
|
301 |
/* set UITextInputTrait properties, mostly to defaults */
|
|
302 |
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
|
303 |
textField.autocorrectionType = UITextAutocorrectionTypeNo;
|
|
304 |
textField.enablesReturnKeyAutomatically = NO;
|
|
305 |
textField.keyboardAppearance = UIKeyboardAppearanceDefault;
|
|
306 |
textField.keyboardType = UIKeyboardTypeDefault;
|
|
307 |
textField.returnKeyType = UIReturnKeyDefault;
|
|
308 |
textField.secureTextEntry = NO;
|
|
309 |
|
|
310 |
textField.hidden = YES;
|
|
311 |
keyboardVisible = NO;
|
|
312 |
/* add the UITextField (hidden) to our view */
|
|
313 |
[self addSubview: textField];
|
|
314 |
|
|
315 |
/* create our SDL_Keyboard */
|
|
316 |
SDL_Keyboard keyboard;
|
|
317 |
SDL_zero(keyboard);
|
|
318 |
SDL_AddKeyboard(&keyboard, 0);
|
|
319 |
SDLKey keymap[SDL_NUM_SCANCODES];
|
|
320 |
SDL_GetDefaultKeymap(keymap);
|
|
321 |
SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
|
|
322 |
|
|
323 |
}
|
|
324 |
|
|
325 |
/* reveal onscreen virtual keyboard */
|
|
326 |
- (void)showKeyboard {
|
|
327 |
keyboardVisible = YES;
|
|
328 |
[textField becomeFirstResponder];
|
|
329 |
}
|
|
330 |
|
|
331 |
/* hide onscreen virtual keyboard */
|
|
332 |
- (void)hideKeyboard {
|
|
333 |
keyboardVisible = NO;
|
|
334 |
[textField resignFirstResponder];
|
|
335 |
}
|
|
336 |
|
|
337 |
/* UITextFieldDelegate method. Invoked when user types something. */
|
|
338 |
- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
339 |
|
|
340 |
if ([string length] == 0) {
|
|
341 |
/* it wants to replace text with nothing, ie a delete */
|
|
342 |
SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE);
|
|
343 |
SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE);
|
|
344 |
}
|
|
345 |
else {
|
|
346 |
/* go through all the characters in the string we've been sent
|
|
347 |
and convert them to key presses */
|
|
348 |
int i;
|
|
349 |
for (i=0; i<[string length]; i++) {
|
|
350 |
|
|
351 |
unichar c = [string characterAtIndex: i];
|
|
352 |
|
|
353 |
Uint16 mod = 0;
|
|
354 |
SDL_scancode code;
|
|
355 |
|
|
356 |
if (c < 127) {
|
|
357 |
/* figure out the SDL_scancode and SDL_keymod for this unichar */
|
|
358 |
code = unicharToUIKeyInfoTable[c].code;
|
|
359 |
mod = unicharToUIKeyInfoTable[c].mod;
|
|
360 |
}
|
|
361 |
else {
|
|
362 |
/* we only deal with ASCII right now */
|
|
363 |
code = SDL_SCANCODE_UNKNOWN;
|
|
364 |
mod = 0;
|
|
365 |
}
|
|
366 |
|
|
367 |
if (mod & KMOD_SHIFT) {
|
|
368 |
/* If character uses shift, press shift down */
|
|
369 |
SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT);
|
|
370 |
}
|
|
371 |
/* send a keydown and keyup even for the character */
|
|
372 |
SDL_SendKeyboardKey( 0, SDL_PRESSED, code);
|
|
373 |
SDL_SendKeyboardKey( 0, SDL_RELEASED, code);
|
|
374 |
if (mod & KMOD_SHIFT) {
|
|
375 |
/* If character uses shift, press shift back up */
|
|
376 |
SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT);
|
|
377 |
}
|
|
378 |
}
|
|
379 |
}
|
|
380 |
return NO; /* don't allow the edit! (keep placeholder text there) */
|
|
381 |
}
|
|
382 |
|
|
383 |
/* Terminates the editing session */
|
|
384 |
- (BOOL)textFieldShouldReturn:(UITextField*)_textField {
|
|
385 |
[self hideKeyboard];
|
|
386 |
return YES;
|
|
387 |
}
|
|
388 |
|
|
389 |
#endif
|
|
390 |
|
|
391 |
@end
|
|
392 |
|
|
393 |
/* iPhone keyboard addition functions */
|
|
394 |
#if SDL_IPHONE_KEYBOARD
|
|
395 |
|
|
396 |
int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
|
|
397 |
|
|
398 |
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
|
399 |
SDL_WindowData *data;
|
|
400 |
SDL_uikitview *view;
|
|
401 |
|
|
402 |
if (NULL == window) {
|
|
403 |
SDL_SetError("Window does not exist");
|
|
404 |
return -1;
|
|
405 |
}
|
|
406 |
|
|
407 |
data = (SDL_WindowData *)window->driverdata;
|
|
408 |
view = data->view;
|
|
409 |
|
|
410 |
if (nil == view) {
|
|
411 |
SDL_SetError("Window has no view");
|
|
412 |
return -1;
|
|
413 |
}
|
|
414 |
else {
|
|
415 |
[view showKeyboard];
|
|
416 |
return 0;
|
|
417 |
}
|
|
418 |
}
|
|
419 |
|
|
420 |
int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
|
|
421 |
|
|
422 |
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
|
423 |
SDL_WindowData *data;
|
|
424 |
SDL_uikitview *view;
|
|
425 |
|
|
426 |
if (NULL == window) {
|
|
427 |
SDL_SetError("Window does not exist");
|
|
428 |
return -1;
|
|
429 |
}
|
|
430 |
|
|
431 |
data = (SDL_WindowData *)window->driverdata;
|
|
432 |
view = data->view;
|
|
433 |
|
|
434 |
if (NULL == view) {
|
|
435 |
SDL_SetError("Window has no view");
|
|
436 |
return -1;
|
|
437 |
}
|
|
438 |
else {
|
|
439 |
[view hideKeyboard];
|
|
440 |
return 0;
|
|
441 |
}
|
|
442 |
}
|
|
443 |
|
|
444 |
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
|
|
445 |
|
|
446 |
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
|
447 |
SDL_WindowData *data;
|
|
448 |
SDL_uikitview *view;
|
|
449 |
|
|
450 |
if (NULL == window) {
|
|
451 |
SDL_SetError("Window does not exist");
|
|
452 |
return -1;
|
|
453 |
}
|
|
454 |
|
|
455 |
data = (SDL_WindowData *)window->driverdata;
|
|
456 |
view = data->view;
|
|
457 |
|
|
458 |
if (NULL == view) {
|
|
459 |
SDL_SetError("Window has no view");
|
|
460 |
return 0;
|
|
461 |
}
|
|
462 |
else {
|
|
463 |
return view.keyboardVisible;
|
|
464 |
}
|
|
465 |
}
|
|
466 |
|
|
467 |
int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
|
|
468 |
|
|
469 |
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
|
470 |
SDL_WindowData *data;
|
|
471 |
SDL_uikitview *view;
|
|
472 |
|
|
473 |
if (NULL == window) {
|
|
474 |
SDL_SetError("Window does not exist");
|
|
475 |
return -1;
|
|
476 |
}
|
|
477 |
|
|
478 |
data = (SDL_WindowData *)window->driverdata;
|
|
479 |
view = data->view;
|
|
480 |
|
|
481 |
if (NULL == view) {
|
|
482 |
SDL_SetError("Window has no view");
|
|
483 |
return -1;
|
|
484 |
}
|
|
485 |
else {
|
|
486 |
if (SDL_iPhoneKeyboardIsShown(windowID)) {
|
|
487 |
SDL_iPhoneKeyboardHide(windowID);
|
|
488 |
}
|
|
489 |
else {
|
|
490 |
SDL_iPhoneKeyboardShow(windowID);
|
|
491 |
}
|
|
492 |
return 0;
|
|
493 |
}
|
|
494 |
}
|
|
495 |
|
|
496 |
#else
|
|
497 |
|
|
498 |
/* stubs, used if compiled without keyboard support */
|
|
499 |
|
|
500 |
int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
|
|
501 |
SDL_SetError("Not compiled with keyboard support");
|
|
502 |
return -1;
|
|
503 |
}
|
|
504 |
|
|
505 |
int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
|
|
506 |
SDL_SetError("Not compiled with keyboard support");
|
|
507 |
return -1;
|
|
508 |
}
|
|
509 |
|
|
510 |
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
|
|
511 |
return 0;
|
|
512 |
}
|
|
513 |
|
|
514 |
int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
|
|
515 |
SDL_SetError("Not compiled with keyboard support");
|
|
516 |
return -1;
|
|
517 |
}
|
|
518 |
|
|
519 |
|
|
520 |
#endif /* SDL_IPHONE_KEYBOARD */
|