Files
devilutionX/SourceX/controls/controller.h
T
Gleb Mazovetskiy a2e821d241 Game controller support
Initial game controller support.

Actions are based on the Switch branch but the controller code itself is
implemented differently, allowing for easy remapping and minimizing
changes to the Source/ directory.

Many subtle and not so subtle controller bugs have been fixed
in this implementation, including:

1. Smoother & more responsive movement with the joysticks.
2. Consistent controls for all the menus in the game (stores, quest log,
etc).
3. Cursor appearance / disappearance at appropriate times.

Low-level controls are abstracted and 3 SDL interfaces are supported:
game controller, joystick, and keyboard. See SourceX/controls/ for more
details on this.

Wishlist for the future:

1. Primary button and use button should attack continously.
   This is hard as it requires checking the cooldowns / attack speed.
2. Quick spell menu navigation is very buggy. It is also buggy in the
   switch branch. I haven't had a change to investigate.
2019-11-06 02:13:07 +01:00

19 lines
335 B
C++

#pragma once
#include "controls/controller_buttons.h"
namespace dvl {
struct ControllerButtonEvent {
ControllerButton button;
bool up;
};
ControllerButtonEvent ToControllerButtonEvent(const SDL_Event &event);
bool IsControllerButtonPressed(ControllerButton button);
void InitController();
} // namespace dvl