Is there a function in SDL that will tell me if a mouse is plugged in? The only thing I could find was actual mouse code. Anyone know if there's such a function?
I haven't touched mouse SDL code that much but If I recall well there was one, anyway the KOS init tells what peripherals are connected through console
Hi fackue , great to see you in our web !
All the information is posted at Chui's Web:
http://chui.dcemu.co.uk/sdl.html
I think so what you are looking for is :
SDL_DC_MapKey(int joy, SDL_DC_button button, SDLKey key)
SDL_DC_EmulateKeyboard(SDL_bool value)
Enable/disable keyboard emulation. By default, emulation is enabled when dreamcast keyboard not present.
This function needs SDL_OpenJoystick call for working.
SDL_DC_EmulateMouse(SDL_bool value)
Enable/disable mouse emulation using analog pad and buttons X & Y (only for first joystick found). By default, emulation is enabled when dreamcast mouse not present.
This function needs SDL_OpenJoystick call for working.
---------------------------------------------------------------------------
In my code usually, for those who dont own a dc mouse i just use:
SDL_Joystick *joystick; <----
and after SDL initialization:
if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0 ) {
fprintf(stderr, "No puedo iniciar SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,
SDL_DOUBLEBUF|SDL_SWSURFACE);
if ( screen == NULL ) {
fprintf(stderr, "No puedo cambiar 640x480 video: %s\n", SDL_GetError());
exit(1);
}
if (SDL_NumJoysticks() >= 1) {
joystick = SDL_JoystickOpen(0);
SDL_JoystickEventState(SDL_ENABLE);
}
SDL_ShowCursor(0);
by this way I can use the pad like the mouse, you wouldn't need to check if the mouse is connected, will be emulated by sdl and the pad. Anyway you can see in te code :
joystick = SDL_JoystickOpen(0);
SDL_JoystickEventState(SDL_ENABLE);
Checking this I think so you should know where the mouse is connected, in case of, but this routine what does is to emulate itself in case of non exist.
Editado por
AdminDC en 25-04-2008 01:33,
16 year hacepuede ver todos los hilos de discusión en este foro.
puede iniciar un nuevo hilo de discusión en este foro.
no puede responder en este hilo de discusión.
no puede empezar en una encuesta en este foro.
puede cargar archivos adjuntos en este foro.
no puede descargar archivos adjuntos en este foro.