- controller: Move inventory coordinates logic to outside of the method to ease visibility and changes; Fix cursor offset when holding items on the inventory; Move cursor between edges of the inventory to ease movement inside. - Renamed InvGetCoord to InvGetSlotCoord. - adding more SLOTXY_xxx options to improve controls code - changed inventory slots comment to improve legibility - fixing bugs and centering sprite on the slot - fix belt item movement - slots 9 and 10 move to belt 8 when moving down using a controller - creating function to return correct mousePos slot to remove code duplication - create BeltGetSlotCoord to get coords for belts and remove duplicates; code cleanup. - adding INV_ROW_SLOT_SIZE to hold the amount of slots on an inv row - improve code for moving item to the belt when it's the last 2 slots. - fix bug that would not update the cursor position when going up on certain conditions. - equip equipment when pressing [use] on the controller - moving items in the inventory as a single instance, and blocking them from moving accordingly. - move item to belt when clicking the spell button (Y) - resetting the cursor takes into consideration if the current slot has an item that is bigger than 1x1 - change whitespace to tabs on inv.h changes - fixing plrctrls.cpp formatting |
||
|---|---|---|
| .. | ||
| devices | ||
| axis_direction.cpp | ||
| axis_direction.h | ||
| controller.cpp | ||
| controller.h | ||
| controller_buttons.h | ||
| controller_motion.cpp | ||
| controller_motion.h | ||
| game_controls.cpp | ||
| game_controls.h | ||
| keymapper.cpp | ||
| keymapper.hpp | ||
| menu_controls.cpp | ||
| menu_controls.h | ||
| modifier_hints.cpp | ||
| modifier_hints.h | ||
| plrctrls.cpp | ||
| plrctrls.h | ||
| README.md | ||
| remap_keyboard.h | ||
| touch.cpp | ||
| touch.h | ||
#Controls handling
DevilutionX supports mouse & keyboard and gamepad input.
This directory currently mostly handles gamepad input.
Low-level gamepad handling is abstracted and 3 implementations are provided:
-
SDL2 controller API.
-
SDL 1&2 joystick API.
This can be used in SDL1 joystick platforms and for mapping additional buttons not defined by SDL2 controller mappings (e.g. additional Nintendo Switch arrows).
-
Keyboard keys acting as controller buttons.
This can be used for testing, or on devices where this is the only or the easiest API to use (e.g. RetroFW).
Example keyboard-as-controller build flags:
cmake .. -DUSE_SDL1=ON -DHAS_KBCTRL=1 -DPREFILL_PLAYER_NAME=ON \
-DKBCTRL_BUTTON_DPAD_LEFT=SDLK_LEFT \
-DKBCTRL_BUTTON_DPAD_RIGHT=SDLK_RIGHT \
-DKBCTRL_BUTTON_DPAD_UP=SDLK_UP \
-DKBCTRL_BUTTON_DPAD_DOWN=SDLK_DOWN \
-DKBCTRL_BUTTON_X=SDLK_y \
-DKBCTRL_BUTTON_Y=SDLK_x \
-DKBCTRL_BUTTON_B=SDLK_a \
-DKBCTRL_BUTTON_A=SDLK_b \
-DKBCTRL_BUTTON_RIGHTSHOULDER=SDLK_RIGHTBRACKET \
-DKBCTRL_BUTTON_LEFTSHOULDER=SDLK_LEFTBRACKET \
-DKBCTRL_BUTTON_LEFTSTICK=SDLK_TAB \
-DKBCTRL_BUTTON_START=SDLK_RETURN \
-DKBCTRL_BUTTON_BACK=SDLK_LSHIFT