4 #include "../generic/managed.h"
6 #include "../keycodes.h"
7 #include "input_state.h"
15 enum DeadZoneBehaviour {
16 DEAD_ZONE_BEHAVIOUR_NONE,
17 DEAD_ZONE_BEHAVIOUR_AXIAL,
18 DEAD_ZONE_BEHAVIOUR_RADIAL
23 AXIS_TYPE_KEYBOARD_KEY,
24 AXIS_TYPE_MOUSE_BUTTON,
26 AXIS_TYPE_JOYSTICK_BUTTON,
27 AXIS_TYPE_JOYSTICK_AXIS,
28 AXIS_TYPE_JOYSTICK_HAT
36 void set_positive_keyboard_key(
const KeyboardCode& key);
37 void set_negative_keyboard_key(
const KeyboardCode& key);
38 KeyboardCode positive_keyboard_key()
const {
return positive_key_; }
39 KeyboardCode negative_keyboard_key()
const {
return negative_key_; }
41 void set_keyboard_source(KeyboardID keyboard);
42 KeyboardID keyboard_source()
const {
return keyboard_source_; }
44 void set_positive_mouse_button(MouseButtonID button);
45 void set_negative_mouse_button(MouseButtonID button);
46 MouseButtonID positive_mouse_button()
const {
return positive_mouse_button_; }
47 MouseButtonID negative_mouse_button()
const {
return negative_mouse_button_; }
48 void set_mouse_source(MouseID mouse);
49 MouseID mouse_source()
const {
return mouse_source_; }
51 void set_positive_joystick_button(JoystickButton button);
52 void set_negative_joystick_button(JoystickButton button);
53 JoystickButton positive_joystick_button()
const {
return positive_joystick_button_; }
54 JoystickButton negative_joystick_button()
const {
return negative_joystick_button_; }
55 void set_joystick_source(GameControllerIndex joystick);
56 GameControllerIndex joystick_source()
const {
return joystick_source_; }
58 void set_mouse_axis(MouseAxis axis);
59 void set_joystick_axis(JoystickAxis axis);
60 void set_joystick_hat_axis(JoystickHatID hat, JoystickHatAxis axis);
65 void set_force(
float f);
66 void set_return_speed(
float ret);
68 const std::string& name()
const {
return name_; }
69 const AxisType& type()
const {
return type_; }
71 float value(DeadZoneBehaviour dead_zone_behaviour=DEAD_ZONE_BEHAVIOUR_RADIAL)
const;
73 void set_dead_zone(
float v) { dead_zone_ = v; dead_zone_reciprocal_ = 1.0f / (1.0f - dead_zone_); }
74 float dead_zone()
const {
return dead_zone_; }
76 void set_inversed(
bool value=
true);
81 AxisType type_ = AXIS_TYPE_UNSET;
83 KeyboardID keyboard_source_ = ALL_KEYBOARDS;
84 KeyboardCode positive_key_ = KEYBOARD_CODE_NONE;
85 KeyboardCode negative_key_ = KEYBOARD_CODE_NONE;
87 MouseID mouse_source_ = ALL_MICE;
88 MouseButtonID positive_mouse_button_ = -1;
89 MouseButtonID negative_mouse_button_ = -1;
91 GameControllerIndex joystick_source_ = ALL_GAME_CONTROLLERS;
92 JoystickButton positive_joystick_button_ = JOYSTICK_BUTTON_INVALID;
93 JoystickButton negative_joystick_button_ = JOYSTICK_BUTTON_INVALID;
95 MouseAxis mouse_axis_ = MOUSE_AXIS_INVALID;
96 JoystickAxis joystick_axis_ = JOYSTICK_AXIS_INVALID;
98 JoystickHatID joystick_hat_ = -1;
99 JoystickHatAxis joystick_hat_axis_ = JOYSTICK_HAT_AXIS_X;
101 float return_speed_ = 3.0f;
105 float dead_zone_ = 0.001f;
106 float dead_zone_reciprocal_ = 1.0f / (1.0f - dead_zone_);
108 bool inversed_ =
false;
114 float linked_value_ = 0.0;
116 void set_type(AxisType type);