SDL Mausposition und Buttons setzen
-
Hi,
ich nach einiger Arbeit mit SDL komm ich nun an einer Stelle nicht weiter.
Folgendes Beispiel:Ich lese wie folgt Mausposition und Buttonstatus aus:
SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)
SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(2)
SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(3)
SDL_GetMouseState(&X, NULL)
SDL_GetMouseState(NULL, &Y)Nun möchte ich aber die Mausposition verstellen. z.B. die Maus auf x=22 y=22 setzen. Wie bewerkstellige ich das mit SDL???
Das ganze sollte im Fenstermodus sowie im Vollbildmodus funtkonieren
mfg
DKing
-
ich kenn sdl nich, aber vielleicht mit SDL_SetMouseState(...) ?
-
Ne, gibt ein extra Modul
http://www.kmc.gr.jp/~ohai/rubysdl_doc.en.html schrieb:
SDL::Mouse
The module mouse constants and mouse functions.
module functionsSDL::Mouse.state
Return mouse state in array. Return value is following,
[ x , y , pressLButton? , pressMButton? , pressRButton? ]
SDL::Mouse.warp(x,y)
Set the position of the mouse cursor (generates a mouse motion event).
SDL::Mouse.show
Show mouse cursor.
SDL::Mouse.hide
Hide mouse cursor.
SDL::Mouse.setCursor(bitmap,white,black,transparent,inverted,hot_x=0,hot_y=0)
SDL::Mouse.set_cursor(bitmap,white,black,transparent,inverted,hot_x=0,hot_y=0)
Change mouse cursor. bitmap is form of cursor,instance of SDL::Surface.The cursor width must be a multiple of 8. The cursor is created in black and white according to bitmap and white,black,transparent,inverted. white,black,transparent,inverted represents that elements in bitmap as pixel value.Ich denke Du suchst "Mouse.warp(x,y)"
-
Hmm, gibts nicht ne lösung ohne extramodul, finde das erstaunenswert, dass im StandartSDL diese Funktion nicht dabei ist

Ah ich hab bisl gegoogelt, das mit dem warpmouse kann sdl auch:
SDL_WarpMouse(int x,int y);Danke
