Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/joystick.cc')
-rw-r--r--src/client/joystick.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/client/joystick.cc b/src/client/joystick.cc
index 486542e..c8f7f9d 100644
--- a/src/client/joystick.cc
+++ b/src/client/joystick.cc
@@ -24,13 +24,13 @@ void Joystick::init()
int nbjoysticks = SDL_NumJoysticks();
if (nbjoysticks) {
- for (int i=0; i < nbjoysticks; i++) {
+ for (int i = 0; i < nbjoysticks; i++) {
SDL_Joystick *joystick = SDL_JoystickOpen(i);
if (joystick) {
- con_print << " joystick " << i+1 << ": " <<
- SDL_JoystickName(i) << " " <<
- SDL_JoystickNumAxes(joystick) << " axes " <<
- SDL_JoystickNumButtons(joystick) << " buttons " << std::endl;
+ con_print << " joystick " << i + 1 << ": " <<
+ SDL_JoystickName(i) << " " <<
+ SDL_JoystickNumAxes(joystick) << " axes " <<
+ SDL_JoystickNumButtons(joystick) << " buttons " << std::endl;
SDL_JoystickClose(joystick);
}
@@ -69,13 +69,13 @@ void Joystick::list()
*/
int nbjoysticks = SDL_NumJoysticks();
if (nbjoysticks) {
- for (int i=0; i < nbjoysticks; i++) {
+ for (int i = 0; i < nbjoysticks; i++) {
SDL_Joystick *joystick = SDL_JoystickOpen(i);
if (joystick) {
- con_print << " joystick " << i+1 << ": " <<
- SDL_JoystickName(i) << " " <<
- SDL_JoystickNumAxes(joystick) << " axes " <<
- SDL_JoystickNumButtons(joystick) << " buttons " << std::endl;
+ con_print << " joystick " << i + 1 << ": " <<
+ SDL_JoystickName(i) << " " <<
+ SDL_JoystickNumAxes(joystick) << " axes " <<
+ SDL_JoystickNumButtons(joystick) << " buttons " << std::endl;
SDL_JoystickClose(joystick);
}
@@ -89,11 +89,11 @@ void Joystick::list()
(*input_joystick) = (float) current_joystick_number;
if (current_joystick_number) {
- current_joystick = SDL_JoystickOpen(current_joystick_number -1);
+ current_joystick = SDL_JoystickOpen(current_joystick_number - 1);
}
if (current_joystick) {
- con_debug << " using joystick " << SDL_JoystickName(current_joystick_number -1) << std::endl;
+ con_debug << " using joystick " << SDL_JoystickName(current_joystick_number - 1) << std::endl;
SDL_JoystickEventState(SDL_ENABLE);
}
}
@@ -105,14 +105,13 @@ bool Joystick::is_enabled()
void Joystick::frame()
{
- if (current_joystick_number != (int) input_joystick->value())
- {
+ if (current_joystick_number != (int) input_joystick->value()) {
if (current_joystick) {
SDL_JoystickEventState(SDL_IGNORE);
SDL_JoystickClose(current_joystick);
current_joystick = 0;
}
-
+
current_joystick_number = (int) input_joystick->value();
if ((current_joystick_number < 1) || (current_joystick_number > SDL_NumJoysticks())) {
current_joystick_number = 0;
@@ -120,11 +119,11 @@ void Joystick::frame()
(*input_joystick) = (float) current_joystick_number;
if (current_joystick_number) {
- current_joystick = SDL_JoystickOpen(current_joystick_number -1);
+ current_joystick = SDL_JoystickOpen(current_joystick_number - 1);
}
if (current_joystick) {
- con_debug << " using joystick " << SDL_JoystickName(current_joystick_number -1) << std::endl;
+ con_debug << " using joystick " << SDL_JoystickName(current_joystick_number - 1) << std::endl;
SDL_JoystickEventState(SDL_ENABLE);
}
}