-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
Hi, I've seen that a gamepad is mandatory, and that the "keyboard support patch" proposed here has a broken link.
Here are my changes in file controller.cpp:
vec3 gamepad_get_stick(int stick, const float deadzone = 0.2f)
{
// I've replaced all the original content of this function with the following:
vec3 pad(0,0,0);float am = 1.f;
if (IsKeyDown(KEY_RIGHT_SHIFT) || IsKeyDown(KEY_LEFT_SHIFT)) am*=0.5f; // use SHIFT to slow down/walk
if (IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_CONTROL)) am*=2.f; // use CTRL to speed up
if (stick==GAMEPAD_STICK_LEFT) {
// use ARROW keys to move the character
if (IsKeyDown(KEY_RIGHT)) pad.x+=am;
if (IsKeyDown(KEY_LEFT)) pad.x-=am;
if (IsKeyDown(KEY_UP)) pad.z-=am;
if (IsKeyDown(KEY_DOWN)) pad.z+=am;
}
else if (stick==GAMEPAD_STICK_RIGHT) {
// use the number pad to move the camera
if (IsKeyDown(KEY_KP_6)) pad.x-=am;
if (IsKeyDown(KEY_KP_4)) pad.x+=am;
if (IsKeyDown(KEY_KP_8)) pad.z+=am;
if (IsKeyDown(KEY_KP_2)) pad.z-=am;
}
return pad;
}This works for me (I'm on Ubuntu Linux).
I'm not making a pull request. I've just posted my code here in case somebody is interested.
@orangeduck: feel free to close this issue whenever you want, and thanks for sharing the project!
Keneyr, wangziming0527, Etavioxy, RobinWitch and ckf104
Metadata
Metadata
Assignees
Labels
No labels