Public Member Functions | Private Types | Private Member Functions | Private Attributes

joystick_manager Class Reference

#include <joystick.hpp>

Collaboration diagram for joystick_manager:
Collaboration graph
[legend]

List of all members.

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.
bool update_highlighted_hex (map_location &highlighted_hex, const map_location &selected_hex)
 Used for relative movement of the cursor.
std::pair< double, double > get_scroll_axis_pair ()
std::pair< double, double > get_cursor_polar_coordinates ()
 TODO fendrin.
std::pair< double, double > get_mouse_axis_pair ()
 TODO fendrin.
double get_thrusta_axis ()
 TODO fendrin.
double get_thrustb_axis ()
 TODO fendrin.
double get_angle ()
 TODO fendrin.
std::pair< double, double > get_polar_coordinates (int joystick_xaxis, int xaxis, int joystick_yaxis, int yaxis)
 TODO fendrin.

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_

Detailed Description

Definition at line 23 of file joystick.hpp.


Member Enumeration Documentation

Enumerator:
NORTH 
NORTH_EAST 
SOUTH_EAST 
SOUTH 
SOUTH_WEST 
NORTH_WEST 
NDIRECTIONS 
WEST 
EAST 

Definition at line 85 of file joystick.hpp.


Constructor & Destructor Documentation

joystick_manager::joystick_manager (  ) 

Definition at line 27 of file joystick.cpp.

References init().

Here is the call graph for this function:

joystick_manager::~joystick_manager (  ) 

Definition at line 35 of file joystick.cpp.

References close().

Here is the call graph for this function:


Member Function Documentation

bool joystick_manager::close (  ) 

Definition at line 39 of file joystick.cpp.

References ERR_JOY, joysticks_, and LOG_JOY.

Referenced by init(), and ~joystick_manager().

Here is the caller graph for this function:

double joystick_manager::get_angle (  ) 
int joystick_manager::get_axis ( int  joystick_axis,
int  axis 
) [private]

Definition at line 237 of file joystick.cpp.

References joysticks_.

Referenced by get_thrusta_axis(), and get_thrustb_axis().

Here is the caller graph for this function:

std::pair< int, int > joystick_manager::get_axis_pair ( int  joystick_xaxis,
int  xaxis,
int  joystick_yaxis,
int  yaxis 
) [private]

Definition at line 212 of file joystick.cpp.

References joysticks_.

Referenced by get_angle(), get_mouse_axis_pair(), get_polar_coordinates(), get_scroll_axis_pair(), and update_highlighted_hex().

Here is the caller graph for this function:

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]

Definition at line 331 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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]

Definition at line 372 of file joystick.cpp.

References EAST, get_direction(), NORTH, NORTH_EAST, NORTH_WEST, map_location::null_location, PI, SOUTH, SOUTH_EAST, SOUTH_WEST, and WEST.

Referenced by update_highlighted_hex().

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< double, double > joystick_manager::get_polar_coordinates ( int  joystick_xaxis,
int  xaxis,
int  joystick_yaxis,
int  yaxis 
)

TODO fendrin.

Definition at line 201 of file joystick.cpp.

References get_axis_pair(), and PI.

Referenced by get_cursor_polar_coordinates().

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< double, double > joystick_manager::get_scroll_axis_pair (  ) 
Returns:
a value in range [-1,+1] representing the gauges of the scroll axes.

Definition at line 138 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().

Here is the call graph for this function:

Here is the caller graph for this function:

double joystick_manager::get_thrusta_axis (  ) 

TODO fendrin.

Definition at line 167 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().

Here is the call graph for this function:

Here is the caller graph for this function:

double joystick_manager::get_thrustb_axis (  ) 
bool joystick_manager::init (  ) 

Definition at line 61 of file joystick.cpp.

References close(), ERR_JOY, preferences::joystick_support_enabled(), joysticks_, and LOG_JOY.

Referenced by joystick_manager().

Here is the call graph for this function:

Here is the caller graph for this function:

bool joystick_manager::update_highlighted_hex ( map_location highlighted_hex  ) 

Used for absolute movement of the cursor.

Parameters:
highlighted_hex will change if the cursor moved.
Returns:
true if the highlighted hex changed.

Definition at line 284 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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool joystick_manager::update_highlighted_hex ( map_location highlighted_hex,
const map_location selected_hex 
)

Used for relative movement of the cursor.

Parameters:
highlighted_hex will change if the cursor moved.
Returns:
true if the highlighted hex changed.

Definition at line 248 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.

Here is the call graph for this function:


Member Data Documentation

Definition at line 98 of file joystick.hpp.

Referenced by update_highlighted_hex().

Definition at line 97 of file joystick.hpp.

Referenced by update_highlighted_hex().

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

Definition at line 96 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:14:20 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs