Files
devilutionX/Source/controls/controller_motion.h
T
Gleb Mazovetskiy 4c2fa76e49 Controller mouse emulation fixes
1. Do not interrupt mouse mode on virtual clicks.
2. Handle virtual clicks directly instead of sending an SDL event.
3. Fix D-Pad mouse emulation state handling.
4. Hides the modifier hints during D-Pad mouse emulation.
2022-04-09 04:17:39 +02:00

31 lines
995 B
C++

#pragma once
// Processes and stores mouse and joystick motion.
#include <SDL.h>
#include "./axis_direction.h"
#include "./controller.h"
namespace devilution {
// Whether we're currently simulating the mouse with SELECT + D-Pad.
extern bool SimulatingMouseWithSelectAndDPad;
// Raw axis values.
extern float leftStickXUnscaled, leftStickYUnscaled, rightStickXUnscaled, rightStickYUnscaled;
// Axis values scaled to [-1, 1] range and clamped to a deadzone.
extern float leftStickX, leftStickY, rightStickX, rightStickY;
// Whether stick positions have been updated and need rescaling.
extern bool leftStickNeedsScaling, rightStickNeedsScaling;
// Updates motion state for mouse and joystick sticks.
bool ProcessControllerMotion(const SDL_Event &event, ControllerButtonEvent ctrlEvent);
// Returns direction of the left thumb stick or DPad (if allow_dpad = true).
AxisDirection GetLeftStickOrDpadDirection(bool allowDpad = true);
} // namespace devilution