Re : Re : New user, question about joystick

Yes, you’re right, you must pass flags to it.

Julien

----- Message d’origine ----De : Mark
? : sdl at libsdl.org
Envoy? le : Vendredi, 18 Juillet 2008, 16h21mn 03s
Objet : Re: [SDL] Re : New user, question about joystick.

Hm It didn’t take zero args. Passed in a null for see but didn’t work.
julien CLEMENT <clementj2005 yahoo.fr> writes:

Actually it returns a Sint16 … but the implicit cast to float (%f) should
work isn’t it ?Anyway, better using %d for that purpose, to make sure …Just a
remark, if you say SDL_Init(SDL_INIT_JOYSTICK) then, if I’m
correct,SDL_InitSubSystem(SDL_INIT_JOYSTICK) is implicitely called, so you
don’t need it.However, you’d do:SDL_Init(); /* no args */SDL_InitSubSystem
(SDL_INIT_JOYSTICK);Correct me if I’m wrongJulien

----- Message d’origine ----De : Peter Mackay <mackay.pete+sdl
gmail.com>? : A list for developers using the SDL library. (includes SDL-
announce)
<sdl lists.libsdl.org>Envoy? le : Vendredi, 18 Juillet 2008, 15h59mn
03sObjet : Re: [SDL] New user, question about joystick.Hmm one more thing. Does
SDL_JoystickAxis return a float? I thought itwas a Uint16 or something like
that.Pete2008/7/18 Mark <marktheguy ymail.com>:> Thanks guys> Made changes
you suggested but not working.> (It does find it)>> #include <stdlib.h>>
#include <SDL.h>>> void SDL_JoystickUpdate(void);> int main(int argc, char *argv
[])> {> SDL_Joystick *joy;> SDL_Init(SDL_INIT_JOYSTICK);> // Initialize the
joystick subsystem> SDL_InitSubSystem(SDL_INIT_JOYSTICK);>> // Check for
joystick> if(SDL_NumJoysticks()>0){> // Open joystick>
joy=SDL_JoystickOpen(0);>> if(joy)> {> printf(“Opened Joystick 0
\n”);> printf(“Name: %s\n”, SDL_JoystickName(0));> printf(“Number of
Axes: %d\n”, SDL_JoystickNumAxes(joy));> printf(“Number of Buttons: %d\n”,
SDL_JoystickNumButtons(joy));> printf(“Number of Balls: %d\n”,
SDL_JoystickNumBalls(joy));> }> else> printf(“Couldn’t open Joystick 0
\n”);>> int SDL_JoystickEventState(true);>> while(1)
{> SDL_JoystickUpdate();> printf
("%f",SDL_JoystickGetAxis(joy, 0));> }> // Close if
opened> if(SDL_JoystickOpened(0))> SDL_JoystickClose(joy);> }

   //Return success!>        return 0;> }>> 

_______________________________________________> SDL mailing list> SDL
lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-
libsdl.org>_______________________________________________SDL mailing listSDL
lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Envoy? avec Yahoo! Mail.Une boite mail plus intelligente.


SDL mailing list
SDL lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  _____________________________________________________________________________ 

Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr