The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
joystick_manager Class Reference

#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, intget_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_
 

Detailed Description

Definition at line 22 of file joystick.hpp.

Member Enumeration Documentation

Enumerator
NORTH 
NORTH_EAST 
SOUTH_EAST 
SOUTH 
SOUTH_WEST 
NORTH_WEST 
NDIRECTIONS 
WEST 
EAST 

Definition at line 84 of file joystick.hpp.

Constructor & Destructor Documentation

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().

Member Function Documentation

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 ( )
int joystick_manager::get_axis ( int  joystick_axis,
int  axis 
)
private

Definition at line 252 of file joystick.cpp.

References attached(), and joysticks_.

Referenced by get_thrusta_axis(), and get_thrustb_axis().

std::pair< int, int > joystick_manager::get_axis_pair ( int  joystick_xaxis,
int  xaxis,
int  joystick_yaxis,
int  yaxis 
)
private
std::pair< double, double > joystick_manager::get_cursor_polar_coordinates ( )
const map_location joystick_manager::get_direction ( const map_location loc,
joystick_manager::DIRECTION  direction 
)
private
std::pair< double, double > joystick_manager::get_mouse_axis_pair ( )
const map_location joystick_manager::get_next_hex ( int  x_axis,
int  y_axis,
map_location  old_hex 
)
private
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 ( )
double joystick_manager::get_thrusta_axis ( )
double joystick_manager::get_thrustb_axis ( )
bool joystick_manager::init ( )
bool joystick_manager::update_highlighted_hex ( map_location highlighted_hex)
bool joystick_manager::update_highlighted_hex ( map_location highlighted_hex,
const map_location selected_hex 
)

Used for relative movement of the cursor.

Parameters
highlighted_hexwill change if the cursor moved.
Returns
true if the highlighted hex changed.

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.

Member Data Documentation

int joystick_manager::counter_
private

Definition at line 97 of file joystick.hpp.

Referenced by update_highlighted_hex().

int joystick_manager::joystick_area_
private

Definition at line 96 of file joystick.hpp.

Referenced by update_highlighted_hex().

std::vector<SDL_Joystick*> joystick_manager::joysticks_
private

Definition at line 95 of file joystick.hpp.

Referenced by close(), get_axis(), get_axis_pair(), and init().


The documentation for this class was generated from the following files: