src/video/uikit/SDL_uikitview.h
author Ryan C. Gordon <icculus@icculus.org>
Mon, 28 Mar 2011 23:21:22 -0400
changeset 5520 09b500e0656d
parent 5262 b530ef003506
child 5527 9a03d2300486
permissions -rw-r--r--
Added orientation rotation for iOS.
slouken@2765
     1
/*
slouken@2765
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 Sam Lantinga
slouken@2765
     4
slouken@2765
     5
    This library is free software; you can redistribute it and/or
slouken@2765
     6
    modify it under the terms of the GNU Lesser General Public
slouken@2765
     7
    License as published by the Free Software Foundation; either
slouken@2765
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@2765
     9
slouken@2765
    10
    This library is distributed in the hope that it will be useful,
slouken@2765
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@2765
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@2765
    13
    Lesser General Public License for more details.
slouken@2765
    14
slouken@2765
    15
    You should have received a copy of the GNU Lesser General Public
jim@4662
    16
    License along with this library; if not, write to the Free Software    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@2765
    17
slouken@2765
    18
    Sam Lantinga
slouken@2765
    19
    slouken@libsdl.org
slouken@2765
    20
*/
slouken@2765
    21
slouken@2765
    22
#import <UIKit/UIKit.h>
slouken@2765
    23
#include "SDL_stdinc.h"
slouken@2765
    24
#include "SDL_events.h"
slouken@2765
    25
jimtla@4677
    26
#define IPHONE_TOUCH_EFFICIENT_DANGEROUS
jimtla@4677
    27
#define FIXED_MULTITOUCH
jimtla@4677
    28
jim@4662
    29
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slouken@2765
    30
#define MAX_SIMULTANEOUS_TOUCHES 5
slouken@2765
    31
#endif
slouken@2765
    32
icculus@5520
    33
@interface SDL_uikitviewcontroller : UIViewController {
icculus@5520
    34
@private
icculus@5520
    35
    SDL_Window *window;
icculus@5520
    36
}
icculus@5520
    37
- (id)initWithSDLWindow:(SDL_Window *)_window;
icculus@5520
    38
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient;
icculus@5520
    39
- (void)loadView;
icculus@5520
    40
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
icculus@5520
    41
@end
icculus@5520
    42
slouken@2765
    43
/* *INDENT-OFF* */
slouken@3487
    44
#if SDL_IPHONE_KEYBOARD
slouken@2765
    45
@interface SDL_uikitview : UIView<UITextFieldDelegate> {
slouken@3487
    46
#else
slouken@3487
    47
@interface SDL_uikitview : UIView {
slouken@3487
    48
#endif
slouken@4488
    49
jimtla@4677
    50
#ifdef FIXED_MULTITOUCH
slouken@5133
    51
    long touchId;
jim@4662
    52
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
slouken@5133
    53
    UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
jim@4662
    54
#endif
slouken@4465
    55
#endif
slouken@2765
    56
slouken@2765
    57
#if SDL_IPHONE_KEYBOARD
slouken@5133
    58
    UITextField *textField;
slouken@5133
    59
    BOOL keyboardVisible;
slouken@5133
    60
#endif    
icculus@5520
    61
icculus@5520
    62
@public
icculus@5520
    63
    SDL_uikitviewcontroller *viewcontroller;
slouken@2765
    64
}
slouken@2765
    65
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
slouken@2765
    66
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
slouken@2765
    67
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
slouken@2765
    68
slouken@2765
    69
#if SDL_IPHONE_KEYBOARD
slouken@2765
    70
- (void)showKeyboard;
slouken@2765
    71
- (void)hideKeyboard;
slouken@2765
    72
- (void)initializeKeyboard;
slouken@2765
    73
@property (readonly) BOOL keyboardVisible;
slouken@2765
    74
#endif 
slouken@2765
    75
slouken@2765
    76
@end
slouken@2765
    77
/* *INDENT-ON* */
slouken@5133
    78
slouken@5133
    79
/* vi: set ts=4 sw=4 expandtab: */