mirror of https://github.com/encounter/SDL.git
Minor objective-c code style improvements
This commit is contained in:
parent
650ace88ca
commit
feb2ab1e85
|
@ -113,7 +113,7 @@ SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldVa
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
{
|
{
|
||||||
/* Set working directory to resource path */
|
/* Set working directory to resource path */
|
||||||
[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
|
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];
|
||||||
|
|
||||||
/* register a callback for the idletimer hint */
|
/* register a callback for the idletimer hint */
|
||||||
SDL_AddHintCallback(SDL_HINT_IDLE_TIMER_DISABLED,
|
SDL_AddHintCallback(SDL_HINT_IDLE_TIMER_DISABLED,
|
||||||
|
|
|
@ -141,18 +141,18 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct our view, passing in SDL's OpenGL configuration data */
|
/* construct our view, passing in SDL's OpenGL configuration data */
|
||||||
view = [[SDL_uikitopenglview alloc] initWithFrame: frame
|
view = [[SDL_uikitopenglview alloc] initWithFrame:frame
|
||||||
scale: scale
|
scale:scale
|
||||||
retainBacking: _this->gl_config.retained_backing
|
retainBacking:_this->gl_config.retained_backing
|
||||||
rBits: _this->gl_config.red_size
|
rBits:_this->gl_config.red_size
|
||||||
gBits: _this->gl_config.green_size
|
gBits:_this->gl_config.green_size
|
||||||
bBits: _this->gl_config.blue_size
|
bBits:_this->gl_config.blue_size
|
||||||
aBits: _this->gl_config.alpha_size
|
aBits:_this->gl_config.alpha_size
|
||||||
depthBits: _this->gl_config.depth_size
|
depthBits:_this->gl_config.depth_size
|
||||||
stencilBits: _this->gl_config.stencil_size
|
stencilBits:_this->gl_config.stencil_size
|
||||||
sRGB: _this->gl_config.framebuffer_srgb_capable
|
sRGB:_this->gl_config.framebuffer_srgb_capable
|
||||||
majorVersion: _this->gl_config.major_version
|
majorVersion:_this->gl_config.major_version
|
||||||
shareGroup: share_group];
|
shareGroup:share_group];
|
||||||
if (!view) {
|
if (!view) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
if (view.viewcontroller != nil) {
|
if (view.viewcontroller != nil) {
|
||||||
view.viewcontroller.view = view;
|
view.viewcontroller.view = view;
|
||||||
}
|
}
|
||||||
[uiwindow addSubview: view];
|
[uiwindow addSubview:view];
|
||||||
|
|
||||||
/* The view controller needs to be the root in order to control rotation on iOS 6.0 */
|
/* The view controller needs to be the root in order to control rotation on iOS 6.0 */
|
||||||
if (uiwindow.rootViewController == nil) {
|
if (uiwindow.rootViewController == nil) {
|
||||||
|
|
|
@ -112,8 +112,8 @@
|
||||||
|
|
||||||
eaglLayer.opaque = YES;
|
eaglLayer.opaque = YES;
|
||||||
eaglLayer.drawableProperties = @{
|
eaglLayer.drawableProperties = @{
|
||||||
kEAGLDrawablePropertyRetainedBacking: @(retained),
|
kEAGLDrawablePropertyRetainedBacking:@(retained),
|
||||||
kEAGLDrawablePropertyColorFormat: colorFormat
|
kEAGLDrawablePropertyColorFormat:colorFormat
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Set the appropriate scale (for retina display support) */
|
/* Set the appropriate scale (for retina display support) */
|
||||||
|
|
|
@ -52,7 +52,7 @@ void _uikit_keyboard_init();
|
||||||
|
|
||||||
- (id)initWithFrame:(CGRect)frame
|
- (id)initWithFrame:(CGRect)frame
|
||||||
{
|
{
|
||||||
if (self = [super initWithFrame: frame]) {
|
if (self = [super initWithFrame:frame]) {
|
||||||
#if SDL_IPHONE_KEYBOARD
|
#if SDL_IPHONE_KEYBOARD
|
||||||
[self initializeKeyboard];
|
[self initializeKeyboard];
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,7 +69,7 @@ void _uikit_keyboard_init();
|
||||||
|
|
||||||
- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
|
- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
|
||||||
{
|
{
|
||||||
CGPoint point = [touch locationInView: self];
|
CGPoint point = [touch locationInView:self];
|
||||||
|
|
||||||
if (normalize) {
|
if (normalize) {
|
||||||
CGRect bounds = self.bounds;
|
CGRect bounds = self.bounds;
|
||||||
|
@ -123,7 +123,7 @@ void _uikit_keyboard_init();
|
||||||
at once, or perhaps in other circumstances. Usually (it seems)
|
at once, or perhaps in other circumstances. Usually (it seems)
|
||||||
all active touches are canceled.
|
all active touches are canceled.
|
||||||
*/
|
*/
|
||||||
[self touchesEnded: touches withEvent: event];
|
[self touchesEnded:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
|
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
|
@ -154,7 +154,7 @@ void _uikit_keyboard_init();
|
||||||
/* Set ourselves up as a UITextFieldDelegate */
|
/* Set ourselves up as a UITextFieldDelegate */
|
||||||
- (void)initializeKeyboard
|
- (void)initializeKeyboard
|
||||||
{
|
{
|
||||||
textField = [[UITextField alloc] initWithFrame: CGRectZero];
|
textField = [[UITextField alloc] initWithFrame:CGRectZero];
|
||||||
textField.delegate = self;
|
textField.delegate = self;
|
||||||
/* placeholder so there is something to delete! */
|
/* placeholder so there is something to delete! */
|
||||||
textField.text = @" ";
|
textField.text = @" ";
|
||||||
|
@ -171,7 +171,7 @@ void _uikit_keyboard_init();
|
||||||
textField.hidden = YES;
|
textField.hidden = YES;
|
||||||
keyboardVisible = NO;
|
keyboardVisible = NO;
|
||||||
/* add the UITextField (hidden) to our view */
|
/* add the UITextField (hidden) to our view */
|
||||||
[self addSubview: textField];
|
[self addSubview:textField];
|
||||||
|
|
||||||
_uikit_keyboard_init();
|
_uikit_keyboard_init();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void _uikit_keyboard_init();
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < [string length]; i++) {
|
for (i = 0; i < [string length]; i++) {
|
||||||
|
|
||||||
unichar c = [string characterAtIndex: i];
|
unichar c = [string characterAtIndex:i];
|
||||||
|
|
||||||
Uint16 mod = 0;
|
Uint16 mod = 0;
|
||||||
SDL_Scancode code;
|
SDL_Scancode code;
|
||||||
|
|
Loading…
Reference in New Issue