#include <joystick.hpp>
Public Member Functions | |
joystick_manager () | |
~joystick_manager () | |
bool | init () |
bool | close () |
bool | update_highlighted_hex (map_location &highlighted_hex) |
Used for absolute movement of the cursor. More... | |
bool | update_highlighted_hex (map_location &highlighted_hex, const map_location &selected_hex) |
Used for relative movement of the cursor. More... | |
std::pair< double, double > | get_scroll_axis_pair () |
std::pair< double, double > | get_cursor_polar_coordinates () |
TODO fendrin. More... | |
std::pair< double, double > | get_mouse_axis_pair () |
TODO fendrin. More... | |
double | get_thrusta_axis () |
TODO fendrin. More... | |
double | get_thrustb_axis () |
TODO fendrin. More... | |
double | get_angle () |
TODO fendrin. More... | |
std::pair< double, double > | get_polar_coordinates (int joystick_xaxis, int xaxis, int joystick_yaxis, int yaxis) |
TODO fendrin. More... | |
Private Types | |
enum | DIRECTION { NORTH, NORTH_EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, NORTH_WEST, NDIRECTIONS, WEST, EAST } |
Private Member Functions | |
std::pair< int, int > | get_axis_pair (int joystick_xaxis, int xaxis, int joystick_yaxis, int yaxis) |
int | get_axis (int joystick_axis, int axis) |
const map_location | get_next_hex (int x_axis, int y_axis, map_location old_hex) |
const map_location | get_direction (const map_location &loc, joystick_manager::DIRECTION direction) |
Private Attributes | |
std::vector< SDL_Joystick * > | joysticks_ |
int | joystick_area_ |
int | counter_ |
Definition at line 22 of file joystick.hpp.
|
private |
Enumerator | |
---|---|
NORTH | |
NORTH_EAST | |
SOUTH_EAST | |
SOUTH | |
SOUTH_WEST | |
NORTH_WEST | |
NDIRECTIONS | |
WEST | |
EAST |
Definition at line 84 of file joystick.hpp.
joystick_manager::joystick_manager | ( | ) |
Definition at line 26 of file joystick.cpp.
References init().
joystick_manager::~joystick_manager | ( | ) |
Definition at line 34 of file joystick.cpp.
References close().
bool joystick_manager::close | ( | ) |
Definition at line 54 of file joystick.cpp.
References attached(), ERR_JOY, i, joysticks_, LOG_JOY, and name().
Referenced by init(), and ~joystick_manager().
double joystick_manager::get_angle | ( | ) |
TODO fendrin.
Definition at line 366 of file joystick.cpp.
References get_axis_pair(), preferences::joystick_cursor_xaxis_num(), preferences::joystick_cursor_yaxis_num(), preferences::joystick_num_cursor_xaxis(), and preferences::joystick_num_cursor_yaxis().
Definition at line 252 of file joystick.cpp.
References attached(), and joysticks_.
Referenced by get_thrusta_axis(), and get_thrustb_axis().
|
private |
Definition at line 227 of file joystick.cpp.
References attached(), and joysticks_.
Referenced by get_angle(), get_mouse_axis_pair(), get_polar_coordinates(), get_scroll_axis_pair(), and update_highlighted_hex().
std::pair< double, double > joystick_manager::get_cursor_polar_coordinates | ( | ) |
TODO fendrin.
Definition at line 206 of file joystick.cpp.
References get_polar_coordinates(), preferences::joystick_cursor_xaxis_num(), preferences::joystick_cursor_yaxis_num(), preferences::joystick_num_cursor_xaxis(), and preferences::joystick_num_cursor_yaxis().
|
private |
Definition at line 346 of file joystick.cpp.
References EAST, is_even(), is_odd(), NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, SOUTH_WEST, WEST, map_location::x, and map_location::y.
Referenced by get_next_hex().
std::pair< double, double > joystick_manager::get_mouse_axis_pair | ( | ) |
TODO fendrin.
Definition at line 119 of file joystick.cpp.
References get_axis_pair(), get_thrusta_axis(), preferences::joystick_mouse_deadzone(), preferences::joystick_mouse_xaxis_num(), preferences::joystick_mouse_yaxis_num(), preferences::joystick_num_mouse_xaxis(), preferences::joystick_num_mouse_yaxis(), and round_double().
|
private |
Definition at line 387 of file joystick.cpp.
References EAST, get_direction(), NORTH, NORTH_EAST, NORTH_WEST, map_location::null_location(), SOUTH, SOUTH_EAST, SOUTH_WEST, and WEST.
Referenced by update_highlighted_hex().
std::pair< double, double > joystick_manager::get_polar_coordinates | ( | int | joystick_xaxis, |
int | xaxis, | ||
int | joystick_yaxis, | ||
int | yaxis | ||
) |
TODO fendrin.
Definition at line 216 of file joystick.cpp.
References get_axis_pair().
Referenced by get_cursor_polar_coordinates().
std::pair< double, double > joystick_manager::get_scroll_axis_pair | ( | ) |
Definition at line 153 of file joystick.cpp.
References get_axis_pair(), get_thrusta_axis(), preferences::joystick_num_scroll_xaxis(), preferences::joystick_num_scroll_yaxis(), preferences::joystick_scroll_deadzone(), preferences::joystick_scroll_xaxis_num(), preferences::joystick_scroll_yaxis_num(), preferences::joystick_support_enabled(), and round_double().
Referenced by controller_base::play_slice().
double joystick_manager::get_thrusta_axis | ( | ) |
TODO fendrin.
Definition at line 182 of file joystick.cpp.
References get_axis(), preferences::joystick_num_thrusta_axis(), preferences::joystick_support_enabled(), preferences::joystick_thrusta_axis_num(), and preferences::joystick_thrusta_deadzone().
Referenced by get_mouse_axis_pair(), and get_scroll_axis_pair().
double joystick_manager::get_thrustb_axis | ( | ) |
TODO fendrin.
Definition at line 194 of file joystick.cpp.
References get_axis(), preferences::joystick_num_thrustb_axis(), preferences::joystick_support_enabled(), preferences::joystick_thrustb_axis_num(), and preferences::joystick_thrustb_deadzone().
bool joystick_manager::init | ( | ) |
Definition at line 76 of file joystick.cpp.
References attached(), close(), ERR_JOY, i, preferences::joystick_support_enabled(), joysticks_, LOG_JOY, and name().
Referenced by joystick_manager().
bool joystick_manager::update_highlighted_hex | ( | map_location & | highlighted_hex | ) |
Used for absolute movement of the cursor.
highlighted_hex | will change if the cursor moved. |
Definition at line 299 of file joystick.cpp.
References counter_, get_axis_pair(), get_next_hex(), joystick_area_, preferences::joystick_cursor_deadzone(), preferences::joystick_cursor_threshold(), preferences::joystick_cursor_xaxis_num(), preferences::joystick_cursor_yaxis_num(), preferences::joystick_num_cursor_xaxis(), preferences::joystick_num_cursor_yaxis(), and round_double().
Referenced by controller_base::play_slice().
bool joystick_manager::update_highlighted_hex | ( | map_location & | highlighted_hex, |
const map_location & | selected_hex | ||
) |
Used for relative movement of the cursor.
highlighted_hex | will change if the cursor moved. |
Definition at line 263 of file joystick.cpp.
References get_axis_pair(), preferences::joystick_cursor_xaxis_num(), preferences::joystick_cursor_yaxis_num(), preferences::joystick_num_cursor_xaxis(), preferences::joystick_num_cursor_yaxis(), round_double(), map_location::x, and map_location::y.
|
private |
Definition at line 97 of file joystick.hpp.
Referenced by update_highlighted_hex().
|
private |
Definition at line 96 of file joystick.hpp.
Referenced by update_highlighted_hex().
|
private |
Definition at line 95 of file joystick.hpp.
Referenced by close(), get_axis(), get_axis_pair(), and init().