Skip to content

Commit

Permalink
iOS: remove some unused code, minor code style cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Oct 27, 2019
1 parent df49e2a commit bda618a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/video/uikit/SDL_uikitviewcontroller.m
Expand Up @@ -286,7 +286,8 @@ - (void)initKeyboard
[center addObserver:self selector:@selector(textFieldTextDidChange:) name:UITextFieldTextDidChangeNotification object:nil];
}

- (NSArray *) keyCommands {
- (NSArray *)keyCommands
{
NSMutableArray *commands = [[NSMutableArray alloc] init];
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
Expand All @@ -296,18 +297,20 @@ - (NSArray *) keyCommands {
return [NSArray arrayWithArray:commands];
}

- (void) handleCommand: (UIKeyCommand *) keyCommand {
- (void)handleCommand:(UIKeyCommand *)keyCommand
{
SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
NSString *input = keyCommand.input;

if (keyCommand.input == UIKeyInputUpArrow) {
if (input == UIKeyInputUpArrow) {
scancode = SDL_SCANCODE_UP;
} else if (keyCommand.input == UIKeyInputDownArrow) {
} else if (input == UIKeyInputDownArrow) {
scancode = SDL_SCANCODE_DOWN;
} else if (keyCommand.input == UIKeyInputLeftArrow) {
} else if (input == UIKeyInputLeftArrow) {
scancode = SDL_SCANCODE_LEFT;
} else if (keyCommand.input == UIKeyInputRightArrow) {
} else if (input == UIKeyInputRightArrow) {
scancode = SDL_SCANCODE_RIGHT;
} else if (keyCommand.input == UIKeyInputEscape) {
} else if (input == UIKeyInputEscape) {
scancode = SDL_SCANCODE_ESCAPE;
}

Expand All @@ -317,10 +320,6 @@ - (void) handleCommand: (UIKeyCommand *) keyCommand {
}
}

- (void) downArrow: (UIKeyCommand *) keyCommand {
NSLog(@"down arrow!");
}

- (void)setView:(UIView *)view
{
[super setView:view];
Expand Down

0 comments on commit bda618a

Please sign in to comment.