Mercurial > sdl-ios-xcode
diff src/joystick/amigaos/SDL_sysjoystick.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
line wrap: on
line diff
--- a/src/joystick/amigaos/SDL_sysjoystick.c Mon May 29 03:53:21 2006 +0000 +++ b/src/joystick/amigaos/SDL_sysjoystick.c Mon May 29 04:04:35 2006 +0000 @@ -70,22 +70,22 @@ }; int -SDL_SYS_JoystickInit (void) +SDL_SYS_JoystickInit(void) { if (!LowLevelBase) { - if (LowLevelBase = OpenLibrary ("lowlevel.library", 37)) + if (LowLevelBase = OpenLibrary("lowlevel.library", 37)) return 2; } else return 2; - D (bug ("%ld joysticks available.\n", SDL_numjoysticks)); + D(bug("%ld joysticks available.\n", SDL_numjoysticks)); return 0; } /* Function to get the device-dependent name of a joystick */ const char * -SDL_SYS_JoystickName (int index) +SDL_SYS_JoystickName(int index) { if (index < 2 && LowLevelBase) { switch (index) { @@ -96,7 +96,7 @@ } } - SDL_SetError ("No joystick available with that index"); + SDL_SetError("No joystick available with that index"); return (NULL); } @@ -107,19 +107,19 @@ */ int -SDL_SYS_JoystickOpen (SDL_Joystick * joystick) +SDL_SYS_JoystickOpen(SDL_Joystick * joystick) { ULONG temp, i; - D (bug ("Opening joystick %ld\n", joystick->index)); + D(bug("Opening joystick %ld\n", joystick->index)); - if (!(joystick->hwdata = SDL_malloc (sizeof (struct joystick_hwdata)))) + if (!(joystick->hwdata = SDL_malloc(sizeof(struct joystick_hwdata)))) return -1; /* This loop is to check if the controller is a joypad */ for (i = 0; i < 20; i++) { - temp = ReadJoyPort (joystick->index ^ 1); // fix to invert amiga joyports - WaitTOF (); + temp = ReadJoyPort(joystick->index ^ 1); // fix to invert amiga joyports + WaitTOF(); } if ((temp & JP_TYPE_MASK) == JP_TYPE_GAMECTLR) @@ -141,39 +141,39 @@ * and update joystick device state. */ void -SDL_SYS_JoystickUpdate (SDL_Joystick * joystick) +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { ULONG data; int i; if (joystick->index < 2) { - data = ReadJoyPort (joystick->index); + data = ReadJoyPort(joystick->index); if (data & JP_DIRECTION_MASK) { if (data & JPF_JOY_DOWN) { if (!(joystick->hwdata->joystate & JPF_JOY_DOWN)) - SDL_PrivateJoystickAxis (joystick, 0, 127); + SDL_PrivateJoystickAxis(joystick, 0, 127); } else if (data & JPF_JOY_UP) { if (!(joystick->hwdata->joystate & JPF_JOY_UP)) - SDL_PrivateJoystickAxis (joystick, 0, -127); + SDL_PrivateJoystickAxis(joystick, 0, -127); } else if (joystick->hwdata-> joystate & (JPF_JOY_UP | JPF_JOY_DOWN)) - SDL_PrivateJoystickAxis (joystick, 0, 0); + SDL_PrivateJoystickAxis(joystick, 0, 0); if (data & JPF_JOY_LEFT) { if (!(joystick->hwdata->joystate & JPF_JOY_LEFT)) - SDL_PrivateJoystickAxis (joystick, 1, -127); + SDL_PrivateJoystickAxis(joystick, 1, -127); } else if (data & JPF_JOY_RIGHT) { if (!(joystick->hwdata->joystate & JPF_JOY_RIGHT)) - SDL_PrivateJoystickAxis (joystick, 1, 127); + SDL_PrivateJoystickAxis(joystick, 1, 127); } else if (joystick->hwdata-> joystate & (JPF_JOY_LEFT | JPF_JOY_RIGHT)) - SDL_PrivateJoystickAxis (joystick, 1, 0); + SDL_PrivateJoystickAxis(joystick, 1, 0); } else if (joystick->hwdata-> joystate & (JPF_JOY_LEFT | JPF_JOY_RIGHT)) { - SDL_PrivateJoystickAxis (joystick, 1, 0); + SDL_PrivateJoystickAxis(joystick, 1, 0); } else if (joystick->hwdata->joystate & (JPF_JOY_UP | JPF_JOY_DOWN)) { - SDL_PrivateJoystickAxis (joystick, 0, 0); + SDL_PrivateJoystickAxis(joystick, 0, 0); } for (i = 0; i < joystick->nbuttons; i++) { @@ -182,9 +182,9 @@ data &= (~(joybut[2])); if (!(joystick->hwdata->joystate & joybut[i])) - SDL_PrivateJoystickButton (joystick, i, SDL_PRESSED); + SDL_PrivateJoystickButton(joystick, i, SDL_PRESSED); } else if (joystick->hwdata->joystate & joybut[i]) - SDL_PrivateJoystickButton (joystick, i, SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, i, SDL_RELEASED); } joystick->hwdata->joystate = data; @@ -195,20 +195,20 @@ /* Function to close a joystick after use */ void -SDL_SYS_JoystickClose (SDL_Joystick * joystick) +SDL_SYS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) - SDL_free (joystick->hwdata); + SDL_free(joystick->hwdata); return; } /* Function to perform any system-specific joystick related cleanup */ void -SDL_SYS_JoystickQuit (void) +SDL_SYS_JoystickQuit(void) { if (LowLevelBase) { - CloseLibrary (LowLevelBase); + CloseLibrary(LowLevelBase); LowLevelBase = NULL; SDL_numjoysticks = 0; }