Programming joysticks

Hello,

I have to program joystick support for a professional
application and we are managing to use SDL as a
portable library. But the joystick we are hoping to
use (a Wingman Rumblepad) doesn’t give the axis
correctly due to a mode problem. If anyone could tell
me something about how to do with this or logitech’s
libraries :P…

The other prob is that in windows, i use old-style
joysticks (game port, not usb) and i cannot get em
detected by SDL(i first add em in the control panel,
but with standar controllers of win). Why could it be?

Many thnx in advance,

Marcos.----------------------------------------------
Marcos Balsa
Computer Science Student

Spain.


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Hello,

i have question too. Is it possible use SDL_joystick to access joyport

where is no joystick, but some other device ?

best regards
mao

What kind of device would it be?

(A friend helped me build an adapter that plugs into a PC’s joystick port
so that I can use old Atari 2600 paddle controllers (analog knobs) on my PC.
SDL reads them just like a normal joystick. I had to reverse the X axis
and take into account the limited range in my code to get it to work right,
though, but so far as SDL was concerned, it was just a joystick.)

-bill!On Mon, Feb 03, 2003 at 03:14:45PM +0100, obr at nri.cz wrote:

Hello,

i have question too. Is it possible use SDL_joystick to access joyport
where is no joystick, but some other device ?

I have to program joystick support for a professional
application and we are managing to use SDL as a
portable library. But the joystick we are hoping to
use (a Wingman Rumblepad) doesn’t give the axis
correctly due to a mode problem. If anyone could tell
me something about how to do with this or logitech’s
libraries :P…

The other prob is that in windows, i use old-style
joysticks (game port, not usb) and i cannot get em
detected by SDL(i first add em in the control panel,
but with standar controllers of win). Why could it be?

i’ve used SDL for joysticks on a game i’m almost done with, and it worked
fine for both USB and Gameport joysticks. Neither of them were Logitech,
tho (1 M$, one Gravis), but i had no problems whatsoever.

M@ the MadProgrammer_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail

Well it’s small sensor developed by my friend. So it’s not jsoystick at all.
I just need to read values on digital and analog inputs.

maoOn Mon, Feb 03, 2003 at 10:08:26AM -0800, Bill Kendrick wrote:

On Mon, Feb 03, 2003 at 03:14:45PM +0100, @obr_at_nri.cz wrote:

Hello,

i have question too. Is it possible use SDL_joystick to access joyport

where is no joystick, but some other device ?

What kind of device would it be?

[…]

Well it’s small sensor developed by my friend. So it’s not
jsoystick at all. I just need to read values on digital and analog
inputs.

Shouldn’t be a problem. Just set up a standard gameport analog
joystick driver in the OS, and have SDL use that through the normal
API.

Note, however, that while windows has a manual joystick calibration
GUI for these drivers, Linux (and possibly other systems) do not, but
instead calibrate joysticks automatically “on the fly”, unless you
explicitly override that feature. Just wanted to mention this,
because it might confuse matters if what you connect doesn’t behave
anything like a joystick.

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`---------------------------> http://olofson.net/audiality -’
http://olofson.nethttp://www.reologica.se —On Tuesday 04 February 2003 08.59, obr at nri.cz wrote:

If it produces the normal joystick signals then it will work as long as
the signals goes according to the specs of the joystick port.On Tuesday 04 February 2003 09:59, obr at nri.cz wrote:

On Mon, Feb 03, 2003 at 10:08:26AM -0800, Bill Kendrick wrote:

On Mon, Feb 03, 2003 at 03:14:45PM +0100, obr at nri.cz wrote:

Hello,

i have question too. Is it possible use SDL_joystick to access

joyport where is no joystick, but some other device ?

What kind of device would it be?

Well it’s small sensor developed by my friend. So it’s not jsoystick
at all. I just need to read values on digital and analog inputs.

I am working on a project under *BSD( FreeBSD ) and I was wondering how would
one go about #including sdl and linking it to ones program I know that sdl
comes with sdl-config --libs to fulfill this needs but I also would like to
include some other libraries such as SDL_image, SDL_mixer, etc… I’ve
googled around and could not get any clear cut answer the official docs dont
mention linking under *BSD. If anyone could help of point me in the right
direction id appreciate it.

Thanks in Advance,–
Juan D. Espinoza

since BSD uses make, gcc etc just as linux does, if you can find linux docs,
those dosc will 99% of the time also work for BSD. Anyways, to link with a
lib like this in gcc or g++, you use -l (ell, not one). if you notice
sdl-config outputs: -lSDL and -lSDLmain, similary if you wanted to link with
SDL_Net lets say, you just put this in your make file (assuming the SDL_Net
lib stuff is in the right place):

-lSDL_Net

not too hard eh?> ----- Original Message -----

From: socomm@pacbell.net (Juan D. Espinoza)
To:
Sent: Tuesday, February 04, 2003 12:42 PM
Subject: [SDL] FreeBSD and SDL oh my!

I am working on a project under *BSD( FreeBSD ) and I was wondering how
would
one go about #including sdl and linking it to ones program I know that sdl
comes with sdl-config --libs to fulfill this needs but I also would like
to
include some other libraries such as SDL_image, SDL_mixer, etc… I’ve
googled around and could not get any clear cut answer the official docs dont
mention linking under *BSD. If anyone could help of point me in the right
direction id appreciate it.

Thanks in Advance,


Juan D. Espinoza


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks for the reply. Here is the problem I am having I am trying to compile
a very simple program and I get the following error:

g++ SDLTest.cc -o test sdl-config --libs
or
g++ SDLTest.cc -o test -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL
-pthread

–ERROR–
SDL/SDL.h: No such file or directory.

I have tried linking the program with sdl-config --libs as well as by
inserting the link arguments by hand. If anyone has any experience working
with FreeBSD and SDL I’d appreciate any suggestions and any help.

–SOURCE–
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include
using namespace std;

int main( )
{
SDL_Surface *screen;

if( SDL_Init( SDL_INIT_VIDEO ) != 0 ){
	cout<<"Unable to initialize SDL: "<<SDL_GetError( )<<'\n';
	exit( 1 );
}

atexit( SDL_Quit );

screen = SDL_SetVideoMode( 800, 600, 16, SDL_FULLSCREEN_ );
if( screen == NULL ){
	cout<<"Unable to set video mode: "<<SDL_GetError( )<<'\n';
	exit( 1 );
}

cout<<"Success!\n";

}

Thank you,–
Juan D. Espinoza

yeah, that looks like a simple problem… 2 things…

try changing <SDL/SDL.h> to “SDL.h” and see if it compiles then.

if that doesnt work, make sure sdl is installed correctly and that sdl’s .h
files are in include/sdl/ or simply in include/> ----- Original Message -----

From: socomm@pacbell.net (Juan D. Espinoza)
To:
Sent: Tuesday, February 04, 2003 6:06 PM
Subject: [SDL] Re: FreeBSD and SDL oh my!

Thanks for the reply. Here is the problem I am having I am trying to compile
a very simple program and I get the following error:

g++ SDLTest.cc -o test sdl-config --libs
or
g++ SDLTest.cc -o test -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL
-pthread

–ERROR–
SDL/SDL.h: No such file or directory.

I have tried linking the program with sdl-config --libs as well as by
inserting the link arguments by hand. If anyone has any experience working
with FreeBSD and SDL I’d appreciate any suggestions and any help.

–SOURCE–
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include
using namespace std;

int main( )
{
SDL_Surface *screen;

if( SDL_Init( SDL_INIT_VIDEO ) != 0 ){
cout<<"Unable to initialize SDL: "<<SDL_GetError( )<<’\n’;
exit( 1 );
}

atexit( SDL_Quit );

screen = SDL_SetVideoMode( 800, 600, 16, SDL_FULLSCREEN_ );
if( screen == NULL ){
cout<<"Unable to set video mode: "<<SDL_GetError( )<<’\n’;
exit( 1 );
}

cout<<“Success!\n”;
}

Thank you,


Juan D. Espinoza


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks for the reply. Here is the problem I am having I am trying to compile
a very simple program and I get the following error:

g++ SDLTest.cc -o test sdl-config --libs
or
g++ SDLTest.cc -o test -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL
-pthread

You’re missing your include path.

I’m not sure if there is an “official” way of doing it, but you need
to add “-I/usr/local/include -I/usr/local/include/SDL” onto the compile
line.

The -I appends to the search path for looking for include files. So
adding the above two arguments will cause the compiler to also look
in /usr/local/include and /usr/local/include/SDL (in that order).

I’m assuming that /usr/local/include is where you installed the SDL
include files (which is the default location on linux boxes IIRC).

Daryl

sdl-config --cflagsOn Tue, 2003-02-04 at 20:21, Daryl Lonnon wrote:

I’m not sure if there is an “official” way of doing it, but you need
to add “-I/usr/local/include -I/usr/local/include/SDL” onto the compile
line.

No, won’t work either way. Also under *BSD SDL is under the
/usr/local/include/ directory. I’ve tried “SDL.h”, “SDL/SDL.H”, <SDL/SDL.h>,
and <SDL.h> none with much luck. Here’s the output:

$ g++ SDLTest.cc -o text -l/usr/local/include -l/usr/local/include/SDL -lSDL
-pthread

SDLTest.cc:1:17: SDL.h: No such file or directory

SDLTest.cc: In function int main()': SDLTest.cc:10:SDL_Surface’ undeclared (first use this function)
SDLTest.cc:10: (Each undeclared identifier is reported only once for each
function it appears in.)
SDLTest.cc:10: screen' undeclared (first use this function) SDLTest.cc:12:SDL_INIT_VIDEO’ undeclared (first use this function)
SDLTest.cc:12: SDL_Init' undeclared (first use this function) SDLTest.cc:13:SDL_GetError’ undeclared (first use this function)
SDLTest.cc:17: SDL_Quit' undeclared (first use this function) SDLTest.cc:19:SDL_FULLSCREEN_’ undeclared (first use this function)
SDLTest.cc:19: `SDL_SetVideoMode’ undeclared (first use this function)On Tuesday 04 February 2003 06:21 pm, Daryl Lonnon wrote:

Ah im fresh out of ideas :(.

Thanks,


Juan D. Espinoza

How about “updatedb” (that’s locate.updatedb on BSD I think) then “locate
SDL.h”.

Regards,

DanielOn Wednesday 05 February 2003 04:01, Juan D. Espinoza wrote:

SDLTest.cc:1:17: SDL.h: No such file or directory

Ah im fresh out of ideas :(.

Err, that should be: -I/usr/local/include

Regards,

DanielOn Wednesday 05 February 2003 04:01, Juan D. Espinoza wrote:

$ g++ SDLTest.cc -o text -l/usr/local/include -l/usr/local/include/SDL
-lSDL -pthread

Err, that should be: -I/usr/local/include
Hmmm … alright seems as if I am having bit of better luck now.

g++ SDLTest.cc -o test -I/usr/local/include -I/usr/local/include/SDL -ISDL
-Ipthread

I am assuming the the character before SDL ( on -lSDL )is and I( eye ) since
placing a l( elle ) before that gives me an error. Anyhow got it to accept
the last compilation argument except that it stopped short with the following
error:

/var/tmp//cc06HgIs.o: In function main': /var/tmp//cc06HgIs.o(.text+0x16): undefined reference toSDL_Init’
/var/tmp//cc06HgIs.o(.text+0x2d): undefined reference to SDL_GetError' /var/tmp//cc06HgIs.o(.text+0x6a): undefined reference toSDL_Quit’
/var/tmp//cc06HgIs.o(.text+0x88): undefined reference to SDL_SetVideoMode' /var/tmp//cc06HgIs.o(.text+0xa4): undefined reference toSDL_GetError’

I really appreciate all the help so far.

Thanks,–
Juan D. Espinoza

Err, that should be: -I/usr/local/include
Hmmm … alright seems as if I am having bit of better luck now.

g++ SDLTest.cc -o test -I/usr/local/include -I/usr/local/include/SDL -ISDL
-Ipthread

Try
g++ SDLTest.cc -o test -I/usr/local/include
-I/usr/local/include/SDL -L/usr/local/lib -lSDL -lpthread

-l option is used to indicate a specific library. so, -lSDL
-I is to specify an additional include directory so, -I/usr/local/include
-L is to specify additional library directory. Its likely you
sdl library will be here, so …

Also see the manual/info page for gcc for details.
man gcc
info gcc

hth,
PallavOn Tue, 4 Feb 2003, Juan D. Espinoza wrote:


Adding features does not necessarily increase functionality – it just
makes the manuals thicker.


| |
|Pallav Nawani |
|Sasken Communication Technologies Ltd. |
|Domlur, Bangalore. |
|_______________________________________________________________|

Scratch that got it work. Thanks to all of you :). Here is what I did I took
the output from sdl-config --clfags and sdl-config --libs and modified it
a bit to the following:

g++ SDLTest.cc -o test -I/usr/local/include/ -D_RENTRANT -D_THREAD_SAFE
-L/usr/local/lib -lSDL -pthread

The result was a successful compile and link. Thanks again :).

Best Regards,–
Juan D. Espinoza

Behalf Of Daryl Lonnon

Thanks for the reply. Here is the problem I am having I am
trying to
compile a very simple program and I get the following error:

g++ SDLTest.cc -o test sdl-config --libs
or
g++ SDLTest.cc -o test -L/usr/local/lib -Wl,-rpath,/usr/local/lib
g++ -lSDL
-pthread

You’re missing your include path.

I’m not sure if there is an “official” way of doing it, but
you need to add “-I/usr/local/include
-I/usr/local/include/SDL” onto the compile line.

sdl-config --cflags> -----Original Message-----

From: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] On
Sent: Tuesday, February 04, 2003 6:21 PM
To: Juan D. Espinoza
Cc: sdl at libsdl.org
Subject: Re: [SDL] Re: FreeBSD and SDL oh my!

The -I appends to the search path for looking for include
files. So adding the above two arguments will cause the
compiler to also look in /usr/local/include and
/usr/local/include/SDL (in that order).

I’m assuming that /usr/local/include is where you installed
the SDL include files (which is the default location on linux
boxes IIRC).

Daryl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl