1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Expose analog joystick input to the Lua API (#14348)

This commit is contained in:
grorp 2024-10-01 17:21:42 +02:00 committed by GitHub
parent 6569fdd4d1
commit 22ef4c8be1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 127 additions and 83 deletions

View file

@ -86,6 +86,11 @@ struct PlayerControl
movement_direction = a_movement_direction;
}
// Sets movement_speed and movement_direction according to direction_keys
// if direction_keys != 0, otherwise leaves them unchanged to preserve
// joystick input.
void setMovementFromKeys();
#ifndef SERVER
// For client use
u32 getKeysPressed() const;
@ -94,6 +99,7 @@ struct PlayerControl
// For server use
void unpackKeysPressed(u32 keypress_bits);
v2f getMovement() const;
u8 direction_keys = 0;
bool jump = false;
@ -102,7 +108,7 @@ struct PlayerControl
bool zoom = false;
bool dig = false;
bool place = false;
// Note: These four are NOT available on the server
// Note: These two are NOT available on the server
float pitch = 0.0f;
float yaw = 0.0f;
float movement_speed = 0.0f;