¡Oh no! ¿Dónde está el JavaScript? El navegador Web no tiene JavaScript activado o no es compatible con JavaScript. Active JavaScript en su explorador Web para ver correctamente este sitio Web o actualizar a un navegador Web que admita JavaScript.
Sabías que...
El portal oficial en Internet de Sega Europa donde se reunían los usuarios de Dreamcast se llamaba Dreamarena.

Mouse in SDL

Última actualización en 16 year hace
F
fackueNuevo
Publicado 16 year hace
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?
NeoblastNeoblastSuper Administrador
Publicado 16 year hace
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
AdminDCAdminDCSuper Administrador
Publicado 16 year hace
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 hace
F
fackueNuevo
Publicado 16 year hace
Thanks for the warm welcome!

I'm not using Chui's SDL though because of the issues it has with sound.

I wrote myself a function to check if a mouse is present using maple_first_mouse(), which is all I appeared to need.

int DC_MousePresent() {

   uint8 mouse = maple_first_mouse();

   if (mouse == 0)
      return 0;
   else
      return 1;

}


Saludos!
puede 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.
Afiliados
SEGA Saturno - Saturn, SEGA y Videojuegos