More constants
This commit is contained in:
parent
cf39a40f29
commit
7ac961ea42
@ -1,6 +1,7 @@
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
#define KEY_UNKNOWN -1
|
||||
#define KEY_SPACE 32
|
||||
#define KEY_APOSTROPHE 39 /* ' */
|
||||
#define KEY_COMMA 44 /* , */
|
||||
@ -246,5 +247,77 @@
|
||||
#define KEY_RIGHT_SUPER 347
|
||||
#define KEY_MENU 348
|
||||
|
||||
#define MOD_SHIFT 0x0001
|
||||
#define MOD_CONTROL 0x0002
|
||||
#define MOD_ALT 0x0004
|
||||
#define MOD_SUPER 0x0008
|
||||
#define MOD_CAPS_LOCK 0x0010
|
||||
#define MOD_NUM_LOCK 0x0020
|
||||
|
||||
#define MOUSE_BUTTON_1 0
|
||||
#define MOUSE_BUTTON_2 1
|
||||
#define MOUSE_BUTTON_3 2
|
||||
#define MOUSE_BUTTON_4 3
|
||||
#define MOUSE_BUTTON_5 4
|
||||
#define MOUSE_BUTTON_6 5
|
||||
#define MOUSE_BUTTON_7 6
|
||||
#define MOUSE_BUTTON_8 7
|
||||
#define MOUSE_BUTTON_LAST MOUSE_BUTTON_8
|
||||
#define MOUSE_BUTTON_LEFT MOUSE_BUTTON_1
|
||||
#define MOUSE_BUTTON_RIGHT MOUSE_BUTTON_2
|
||||
#define MOUSE_BUTTON_MIDDLE MOUSE_BUTTON_3
|
||||
|
||||
#define JOYSTICK_1 0
|
||||
#define JOYSTICK_2 1
|
||||
#define JOYSTICK_3 2
|
||||
#define JOYSTICK_4 3
|
||||
#define JOYSTICK_5 4
|
||||
#define JOYSTICK_6 5
|
||||
#define JOYSTICK_7 6
|
||||
#define JOYSTICK_8 7
|
||||
#define JOYSTICK_9 8
|
||||
#define JOYSTICK_10 9
|
||||
#define JOYSTICK_11 10
|
||||
#define JOYSTICK_12 11
|
||||
#define JOYSTICK_13 12
|
||||
#define JOYSTICK_14 13
|
||||
#define JOYSTICK_15 14
|
||||
#define JOYSTICK_16 15
|
||||
#define JOYSTICK_LAST JOYSTICK_16
|
||||
|
||||
#define GAMEPAD_BUTTON_A 0
|
||||
#define GAMEPAD_BUTTON_B 1
|
||||
#define GAMEPAD_BUTTON_X 2
|
||||
#define GAMEPAD_BUTTON_Y 3
|
||||
#define GAMEPAD_BUTTON_LEFT_BUMPER 4
|
||||
#define GAMEPAD_BUTTON_RIGHT_BUMPER 5
|
||||
#define GAMEPAD_BUTTON_BACK 6
|
||||
#define GAMEPAD_BUTTON_START 7
|
||||
#define GAMEPAD_BUTTON_GUIDE 8
|
||||
#define GAMEPAD_BUTTON_LEFT_THUMB 9
|
||||
#define GAMEPAD_BUTTON_RIGHT_THUMB 10
|
||||
#define GAMEPAD_BUTTON_DPAD_UP 11
|
||||
#define GAMEPAD_BUTTON_DPAD_RIGHT 12
|
||||
#define GAMEPAD_BUTTON_DPAD_DOWN 13
|
||||
#define GAMEPAD_BUTTON_DPAD_LEFT 14
|
||||
#define GAMEPAD_BUTTON_LAST GAMEPAD_BUTTON_DPAD_LEFT
|
||||
|
||||
#define GAMEPAD_BUTTON_CROSS GAMEPAD_BUTTON_A
|
||||
#define GAMEPAD_BUTTON_CIRCLE GAMEPAD_BUTTON_B
|
||||
#define GAMEPAD_BUTTON_SQUARE GAMEPAD_BUTTON_X
|
||||
#define GAMEPAD_BUTTON_TRIANGLE GAMEPAD_BUTTON_Y
|
||||
|
||||
#define GAMEPAD_AXIS_LEFT_X 0
|
||||
#define GAMEPAD_AXIS_LEFT_Y 1
|
||||
#define GAMEPAD_AXIS_RIGHT_X 2
|
||||
#define GAMEPAD_AXIS_RIGHT_Y 3
|
||||
#define GAMEPAD_AXIS_LEFT_TRIGGER 4
|
||||
#define GAMEPAD_AXIS_RIGHT_TRIGGER 5
|
||||
#define GAMEPAD_AXIS_LAST GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
|
||||
#define ACTION_RELEASE 0
|
||||
#define ACTION_PRESS 1
|
||||
#define ACTION_REPEAT 2
|
||||
|
||||
|
||||
#endif /* CONSTANTS_H */
|
||||
|
@ -4,10 +4,6 @@ local ball
|
||||
local ball1
|
||||
local camera
|
||||
|
||||
local UP = 265
|
||||
local DOWN = 264
|
||||
local Q = 81
|
||||
|
||||
local vx = 0.0
|
||||
local vz = 0.0
|
||||
|
||||
@ -90,29 +86,13 @@ function update(delta)
|
||||
end
|
||||
|
||||
function onkey(key, code, action, mod)
|
||||
if key == KEY_LEFT and action == 1 then
|
||||
vx = -1.0
|
||||
elseif key == KEY_RIGHT and action == 1 then
|
||||
vx = 1.0
|
||||
elseif (key == KEY_LEFT or key == KEY_RIGHT) and action == 0 then
|
||||
vx = 0.0
|
||||
end
|
||||
|
||||
if key == couch.KEY_W and action == 1 then
|
||||
if key == couch.KEY_W and action == couch.ACTION_PRESS then
|
||||
vz = 1.0
|
||||
elseif key == couch.KEY_S and action == 1 then
|
||||
elseif key == couch.KEY_S and action == couch.ACTION_PRESS then
|
||||
vz = -1.0
|
||||
elseif (key == couch.KEY_W or key == couch.KEY_S) and action == 0 then
|
||||
elseif (key == couch.KEY_W or key == couch.KEY_S) and action == couch.ACTION_RELEASE then
|
||||
vz = 0.0
|
||||
end
|
||||
|
||||
if key == Q then
|
||||
if action == 1 then
|
||||
cam_rot_x = 1.0
|
||||
elseif action == 0 then
|
||||
cam_rot_x = 0.0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function onmousemotion(_, _, relx, rely)
|
||||
|
Loading…
Reference in New Issue
Block a user