Mauszeigergeschwindigkeit
Verfasst: 08.04.2005 17:20
Ich habe ein Spiel. Das Spiel ist mit einem screen. Jetzt ist die maus aber viel zu langsam. Wie kann ich die mausgeschwindigkeit ändern?
Code: Alles auswählen
InitSprite():InitMouse():InitKeyboard()
OpenScreen(800,600,32,"Hallo Welt -_-")
Repeat
ExamineMouse()
ExamineKeyboard()
ClearScreen(0,0,0)
If MouseDeltaX() > 0 Or MouseDeltaX() < 0
mousePosX + MouseDeltaX() * 2 ;Hier Speed einstellen
EndIf
If MouseDeltaY() > 0 Or MouseDeltaY() < 0
mousePosY + MouseDeltaY() * 2 ;Und hier natürlich auch ;)
EndIf
StartDrawing(ScreenOutput())
Box(mousePosX,mousePosY,5,5,RGB(255,0,0))
StopDrawing()
FlipBuffers()
Until MouseButton(1) Or KeyboardPushed(1)
Code: Alles auswählen
InitSprite():InitMouse():InitKeyboard()
OpenScreen(800,600,32,"Hallo Welt -_-")
Repeat
ExamineMouse()
ExamineKeyboard()
ClearScreen(0,0,0)
If MouseDeltaX() > 0 Or MouseDeltaX() < 0
If mousePosX + MouseDeltaX() * 2 < 800 And mousePosx + MouseDeltaX() * 2 >1
mousePosX + MouseDeltaX() * 2
EndIf
EndIf
If MouseDeltaY() > 0 Or MouseDeltaY() < 0
If mousePosy + MouseDeltaY() * 2 < 600 And mousePosy + MouseDeltaY() * 2 >1
mousePosy + MouseDeltay() * 2
EndIf
EndIf
StartDrawing(ScreenOutput())
Box(mousePosX,mousePosY,5,5,RGB(255,0,0))
StopDrawing()
FlipBuffers()
Until MouseButton(1) Or KeyboardPushed(1)
MS hat geschrieben: This next example uses SystemParametersInfo to double the mouse speed and update the MouseSpeed value in the WIN.INI file.
TCHAR tchBuffer[BUFFER]; // buffer for expanded string
int nSize; // size of string
int aMouseInfo[3]; // array for mouse information
// Get the current mouse speed.
SystemParametersInfo(SPI_GETMOUSE, // get mouse information
NULL, // not used
&aMouseInfo, // holds mouse information
NULL); // not used
// Double it.
aMouseInfo[2] = 2 * aMouseInfo[2];
// Change the mouse speed to the new value and update WIN.INI.
SystemParametersInfo(SPI_SETMOUSE, // set mouse information
NULL, // not used
aMouseInfo, // mouse information
SPIF_UPDATEINIFILE); // update win.ini
Code: Alles auswählen
;mouspeed einholen
SystemParametersInfo_(#SPI_GETMOUSE, #Null, @aMouseInfo, #Null)
;neuen speed angeben (fehlt)
;und neuen setzen
SystemParametersInfo_(#SPI_SETMOUSE, #Null, aMouseInfo, #SPIF_UPDATEINIFILE)
Code: Alles auswählen
aMouseInfo[2] = 2 * aMouseInfo[2];
Code: Alles auswählen
#SPI_SETMOUSESPEED = 113
#SPIF_SENDCHANGE = 2
Procedure SetMouseSpeed(Speed)
ProcedureReturn SystemParametersInfo_(#SPI_SETMOUSESPEED, #Null, Speed, #SPIF_SENDCHANGE)
EndProcedure
SetMouseSpeed(20) ;10 Default, 1 Minimum, 20 Maximum