2
* OpenTyrian: A modern cross-platform port of Tyrian
3
* Copyright (C) 2007-2009 The OpenTyrian Development Team
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33
Joystick_assignment_types;
37
Joystick_assignment_types type;
41
bool x_axis; // else y_axis
44
bool negative_axis; // else positive
52
Joystick_assignment assignment[10][2]; // 0-3: directions, 4-9: actions
55
int sensitivity, threshold;
58
int analog_direction[4];
59
bool direction[4], direction_pressed[4]; // up, right, down, left (_pressed, for emulating key presses)
62
bool action[6], action_pressed[6]; // fire, mode swap, left fire, right fire, menu, pause
64
Uint32 joystick_delay;
69
extern int joystick_repeat_delay;
71
extern bool ignore_joystick;
73
extern Joystick *joystick;
75
int joystick_axis_reduce( int j, int value );
76
bool joystick_analog_angle( int j, float *angle );
78
void poll_joystick( int j );
79
void poll_joysticks( void );
81
void push_key( SDLKey key );
82
void push_joysticks_as_keyboard( void );
84
void init_joysticks( void );
85
void deinit_joysticks( void );
87
void reset_joystick_assignments( int j );
88
bool load_joystick_assignments( int j );
89
bool save_joystick_assignments( int j );
91
void joystick_assignments_to_string( char *buffer, size_t buffer_len, const Joystick_assignment *assignments );
93
bool detect_joystick_assignment( int j, Joystick_assignment *assignment );
94
bool joystick_assignment_cmp( const Joystick_assignment *, const Joystick_assignment * );
96
#endif /* JOYSTICK_H */