That is like i did, but i did whit the axis…but the axis just have axi x
or axi y, and the values…
im talking about the analog axis of gamepad ( my english its not so good, im
not sure what is a hat, but i want get the diagonals of the analog axis, not
of the hat…)
here my code:
*case SDL_JOYAXISMOTION:
if( event_test.jaxis.axis==1){ //axi Y
if(event_test.jaxis.value<-1){// pressing up
backg_img->clip_rect.y = backg_img->clip_rect.y-5;
}
else if(event_test.jaxis.value>-1){//pressing down
backg_img->clip_rect.y =
backg_img->clip_rect.y+5;//(desce +5)
}
}
if( event_test.jaxis.axis==0){// axis X
if(event_test.jaxis.value<-1){//pressing left
backg_img->clip_rect.x = backg_img->clip_rect.x-5;
}
else if(event_test.jaxis.value>-1){//pressing right
backg_img->clip_rect.x = backg_img->clip_rect.x+5;
}
}
break;
*I just cant figure out how get axi x AND axi y since it just return one per
time…
2008/5/20 mars999 :> Are you talking about the hat switch on the joystick or gamepad?
This should work
case SDL_JOYHATMOTION:
if(sdlEvent->jhat.which == 0)
{
if(sdlEvent->jhat.value == SDL_HAT_UP)
{
}
if(sdlEvent->jhat.value == SDL_HAT_DOWN)
{
}
if(sdlEvent->jhat.value == SDL_HAT_LEFT)
{
}
if(sdlEvent->jhat.value == SDL_HAT_RIGHT)
{
}
if(sdlEvent->jhat.value == SDL_HAT_CENTERED)
{
}
if(sdlEvent->jhat.value == SDL_HAT_RIGHTUP)
{
}
if(sdlEvent->jhat.value == SDL_HAT_RIGHTDOWN)
{
}
if(sdlEvent->jhat.value == SDL_HAT_LEFTDOWN)
{
}
if(sdlEvent->jhat.value == SDL_HAT_LEFTUP)
{
}
}
break;
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
*On Behalf Of *Giuliano Pieta
Sent: Tuesday, May 20, 2008 8:14 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Ok, my doubt is about joysticks and axis…
Well, first i want say im not a high advanced skilled programmer,
so…probaly my doubt is very simple, i guess
The problem is that i cant get a diagonal whit the axis, i didnt figure out
how do that, cause SDL just get axi x or axi y, so how i do to get the both?
=) too stupid?
2008/5/20 Mason Wheeler :
Subscribe to the list to get messages. To post to the list, just send an
email to the list’s mailing address, like you just did. It’s that simple.
----- Original Message ----
From: Giuliano Pieta <@Giuliano_Pieta>
To: A list for developers using the SDL library. (includes SDL-announce) <
sdl at lists.libsdl.org>
Sent: Tuesday, May 20, 2008 4:53:26 PM
Subject: Re: [SDL] i want post on the list
lol
geeses, that mainlist is very confuse, how i do to post a doubt and see the
feedback i get?
.>"
2008/5/20 Leo Cabrera :
Uhh… you just posted. =)
Giuliano Pieta wrote:
SDL mailing list
SDL at 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
SDL mailing list
SDL at 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