mouse.Dx
( Brutus2D 1.7 )
mouse.Dx - returns change in x position of the mouse since last call
Description
xmov = mouse.Dx
- xmov - change in pixels in x direction
mouse.Dx returns the change in mouse X position since the last call. Between calls the value is reset to 0. The value is updated by calling mouse.Update, so remember to place it in your game loop.
Examples
graphics.Initialize
key.Initialize
mouse.Initialize
font = graphics.CreateFont( "system", 10 )
Do While Not ( key.Pressed( vk_escape ) Or key.Pressed( vk_windowx ) )
graphics.Clear
graphics.SetText "Dx: " & mouse.Dx, 10, 10, font, &hFFFFFFFF
graphics.SetText "Dy: " & mouse.Dy, 10, 26, font, &hFFFFFFFF
graphics.SetText "Dz: " & mouse.Dz, 10, 58, font, &hFFFFFFFF
graphics.SetText "(mouse wheel)", 10, 74, font, &hFFFFFFFF
graphics.Display
system.ProcessMessages
system.Pause 100
mouse.Update
Loop
mouse.Terminate
key.Terminate
graphics.Terminate
Known Issues
- Coordinates are updated even if your window does not have focus. For a fix see mouse fix
Related Pages
- mouse.Dy - get change in y coordinate.
- mouse.X - get x coordinates of mouse.
- mouse.Y - get y coordinates of mouse.
- mouse.Initialize - start the mouse object.
- mouse.Terminate - kill the mouse object.
page_revision: 2, last_edited: 1215023622|%e %b %Y, %H:%M %Z (%O ago)