You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
706 B
Objective-C
35 lines
706 B
Objective-C
#import "InputHandler.h"
|
|
|
|
@implementation InputHandler
|
|
|
|
-(id) init {
|
|
self = [super init];
|
|
return self;
|
|
}
|
|
|
|
-(void) handleInput {
|
|
static unsigned int set;
|
|
|
|
if (set == 0) {
|
|
set = IsKeyDown(KEY_W);
|
|
}
|
|
|
|
if ( set - IsKeyDown(KEY_W) ) {
|
|
[controllable moveForward];
|
|
} else if ( set - IsKeyDown(KEY_S) ) {
|
|
[controllable moveBack];
|
|
} else if ( set - IsKeyDown(KEY_A) ) {
|
|
[controllable moveLeft];
|
|
} else if ( set - IsKeyDown(KEY_D) ) {
|
|
[controllable moveRight];
|
|
} else if ( set - IsKeyDown(KEY_E) ) {
|
|
[controllable activate];
|
|
}
|
|
|
|
|
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
|
[controllable attack];
|
|
}
|
|
}
|
|
|
|
@end |