Skip to content

MouseXSpeed

Narta Xaymar Dirks edited this page Oct 30, 2026 · 7 revisions

Blitz3DBlitzPlusBlitzBasic

MouseXSpeed

MouseXSpeed:Int32

Returns: The change of the horizontal position since the previous call.

Description

How far the pointer moved sideways since the last time this function was called. It gives the same result whether the pointer reached the edge of the window or not, which makes it useful for looking around in a 3D scene: call MoveMouse every frame to put the pointer back in the middle and use the speed as the turning amount.

Differences

  • Putting the pointer somewhere with MoveMouse does not count as movement, the same as in the original. To make that work on every platform the window captures the pointer for as long as the program keeps calling MoveMouse; it lets go about 300 milliseconds after the last call.
  • The Device argument is a BlitzLLVM extension: the original has no such argument and only knows one mouse.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local x = 160
While Not KeyHit(1)
	x = x + MouseXSpeed()
	MoveMouse 160, 120
	Cls
	Text 10, 10, "Move the mouse sideways"
	Oval x - 8, 110, 16, 16, 1
	Flip
Wend

Related Commands

MouseChanged, MouseDeviceConnected, MouseDeviceCount, MouseDeviceName, MouseDown, MouseX, MouseYSpeed, MouseZSpeed

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally