30 |
30 |
31 function KeyBindToCode(bind: shortstring): LongInt; |
31 function KeyBindToCode(bind: shortstring): LongInt; |
32 function KeyBindToName(bind: shortstring): shortstring; |
32 function KeyBindToName(bind: shortstring): shortstring; |
33 //procedure MaskModifier(var code: LongInt; modifier: LongWord); |
33 //procedure MaskModifier(var code: LongInt; modifier: LongWord); |
34 procedure MaskModifier(Modifier: shortstring; var code: LongInt); |
34 procedure MaskModifier(Modifier: shortstring; var code: LongInt); |
35 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean); |
35 procedure ProcessMouseButton(event: TSDL_MouseButtonEvent; ButtonDown: boolean); |
|
36 procedure ProcessMouseMotion(xrel, yrel: LongInt); |
36 //procedure ProcessMouseWheel(x, y: LongInt); |
37 //procedure ProcessMouseWheel(x, y: LongInt); |
37 procedure ProcessMouseWheel(y: LongInt); |
38 procedure ProcessMouseWheel(y: LongInt); |
38 procedure ProcessKey(event: TSDL_KeyboardEvent); inline; |
39 procedure ProcessKey(event: TSDL_KeyboardEvent); inline; |
39 procedure ProcessKey(code: LongInt; KeyDown: boolean); |
40 procedure ProcessKey(code: LongInt; KeyDown: boolean); |
40 |
41 |
57 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); |
58 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); |
58 procedure ControllerHatEvent(joy, hat, value: Byte); |
59 procedure ControllerHatEvent(joy, hat, value: Byte); |
59 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean); |
60 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean); |
60 |
61 |
61 implementation |
62 implementation |
62 uses uConsole, uCommands, uVariables, uConsts, uUtils, uDebug, uPhysFSLayer; |
63 uses uConsole, uCommands, uVariables, uConsts, uUtils, uDebug, uPhysFSLayer, uCursor; |
63 |
64 |
64 const |
65 const |
65 LSHIFT = $0200; |
66 LSHIFT = $0200; |
66 RSHIFT = $0400; |
67 RSHIFT = $0400; |
67 LALT = $0800; |
68 LALT = $0800; |
276 code:= LongInt(event.keysym.scancode); |
277 code:= LongInt(event.keysym.scancode); |
277 //writelntoconsole('[KEY] '+inttostr(code)+ ' -> ''' +KeyNames[code] + ''', type = '+inttostr(event.type_)); |
278 //writelntoconsole('[KEY] '+inttostr(code)+ ' -> ''' +KeyNames[code] + ''', type = '+inttostr(event.type_)); |
278 ProcessKey(code, event.type_ = SDL_KEYDOWN); |
279 ProcessKey(code, event.type_ = SDL_KEYDOWN); |
279 end; |
280 end; |
280 |
281 |
281 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean); |
282 procedure ProcessMouseButton(event: TSDL_MouseButtonEvent; ButtonDown: boolean); |
282 begin |
283 begin |
283 //writelntoconsole('[MOUSE] '+inttostr(event.button)); |
284 //writelntoconsole('[MOUSE] '+inttostr(event.button)); |
284 case event.button of |
285 case event.button of |
285 SDL_BUTTON_LEFT: |
286 SDL_BUTTON_LEFT: |
286 ProcessKey(KeyNameToCode('mousel'), ButtonDown); |
287 ProcessKey(KeyNameToCode('mousel'), ButtonDown); |
287 SDL_BUTTON_MIDDLE: |
288 SDL_BUTTON_MIDDLE: |
288 ProcessKey(KeyNameToCode('mousem'), ButtonDown); |
289 ProcessKey(KeyNameToCode('mousem'), ButtonDown); |
289 SDL_BUTTON_RIGHT: |
290 SDL_BUTTON_RIGHT: |
290 ProcessKey(KeyNameToCode('mouser'), ButtonDown); |
291 ProcessKey(KeyNameToCode('mouser'), ButtonDown); |
291 end; |
292 end; |
|
293 end; |
|
294 |
|
295 procedure ProcessMouseMotion(xrel, yrel: LongInt); |
|
296 begin |
|
297 uCursor.updatePositionDelta(xrel, yrel); |
292 end; |
298 end; |
293 |
299 |
294 var mwheelupCode, mwheeldownCode: Integer; |
300 var mwheelupCode, mwheeldownCode: Integer; |
295 |
301 |
296 //procedure ProcessMouseWheel(x, y: LongInt); |
302 //procedure ProcessMouseWheel(x, y: LongInt); |