Skip to content

Commit 88f7151

Browse files
committed
feat: add joystick support for weapon reloading functionality
1 parent c6b6a2b commit 88f7151

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/game/systems/projectile-system.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ namespace gameplay {
109109
if (!weapon || !playerComp) return false;
110110
if (weapon->timer > 0.0f) return false; // still in cooldown / already reloading
111111

112-
bool wantsReload = app->getKeyboard().justPressed(GLFW_KEY_R) && weapon->currentAmmo < weapon->magSize;
112+
bool wantsReload =
113+
(app->getKeyboard().justPressed(GLFW_KEY_R) || app->getJoystick().justPressed(GLFW_GAMEPAD_BUTTON_Y)) &&
114+
weapon->currentAmmo < weapon->magSize;
113115
bool needsAutoReload = weapon->currentAmmo <= 0;
114116

115117
if ((wantsReload || needsAutoReload) && weapon->maxAmmo > 0) {

0 commit comments

Comments
 (0)