debug = mouse.CursorPos
mouse.CursorPos = [512, 300]
Mouse.X and Mouse.Y
Sometimes it is easier to specify the mouse pointer location as a fraction of the screen size. That is good if we don’t know how wide the screen is. Do that with mouse.x and mouse.y. Note that games which don’t use the cursor will still ignore these values, so for some games you need to use DirectInputX and DirectInputY instead. This also makes no sense for multiple mice individually, since they share the cursor.
Mouse.x is the horizontal position of the cursor, between 0 and 1. 0 is the left hand side of the primary monitor, and 1 is the right hand side. Note that if the cursor is on a different monitor it will be outside that range.
Mouse.y is the vertical position of the cursor, between 0 and 1. 0 is the top of the primary monitor, and 1 is the bottom. Again it may be outside this range if on another monitor.
Note that unlike the joystick, which goes from -1 to 1, the mouse only goes from 0 to 1. So to control the cursor based on the joystick position you need to use something like the MapRange function. eg…
mouse.x = MapRange(joystick.x, -1, 1, 0, 1)
That will convert from the joystick’s range of -1, 1 to the mouse’s range of 0, 1.
Mouse.ScreenFraction sets or reads both mouse.x and mouse.y at once, as a vector.
Mouse.VirtualDesktopX and Mouse.VirtualDesktopY
The problem with the mouse.x and mouse.y values is that you need to set them to less than 0 or greater than 1 to put the cursor on another monitor.
If you want to set or read the position as a fraction of the entire Virtual Desktop, then you should use mouse.VirtualDesktopX and mouse.VirtualDesktopY instead.
Mouse.x is the horizontal position, with 0 being the left side of the left-most monitor, and 1 being the right side of the right-most monitor.
As you can guess, Mouse.y is the vertical position.
Mouse.DesktopFraction is the vector equivalent for setting or reading both mouse.VirtualDesktopX and mouse.VirtualDesktopY at once.
PC Mice usually have between 2 and 5 buttons. You can read or set them in GlovePIE with:
The X Buttons do various things like move backwards and forwards in a web browser, and they are only found on special mice. Most modern games will support them, so they are very useful.
In theory some things in windows also support mouse buttons 6, 7 and 8.
You can set or read them with these values:
But current windows versions don’t seem to allow you to set them. Reading them may theoretically work though, although in practice mice with more than 5 buttons probably work a different way.
Note that if you have multiple mice connected to Windows XP, you can read the buttons individually, with mouse1.LeftButton, mouse2.LeftButton, mouse3.LeftButton, etc. Without a number it reads the combination of all the mice.
All the mouse buttons can be set to either True or False. True is equivalent to 1, and false is equivalent to 0, except when you add true/false values it means “and”, and when you divide, it means “or”.
midi.BassDrum1 = mouse.LeftButton+mouse.RightButton
will play the drum when you have both the left and right buttons held down at once.
Mouse.DoubleClickTime is the maximum time between the clicks in double clicks that will still be recognised as a double click. If clicks are further apart than this time, they are two single clicks. It is the same for all the mice connected to the computer.
Actually GlovePIE also uses this same value for keyboard and other double-clicks using it’s DoubleClicked( ) function.
It is in seconds by default, but in GlovePIE you can use any units you like and it will convert them.
Mouse.Count is the number of mice connected to the computer. It only works on Windows XP, otherwise it will always return 1. This value doesn’t count the extra Windows XP Pro Remote Desktop cursor, which can be accessed as Mouse0 on Windows XP Pro.
Mice are numbered from 1 to mouse.count. Plus an extra mostly useless mouse0 on XP Pro.
Mouse.CursorVisible is true when the cursor is visible, and false when it isn’t. At least, that’s the theory. Some programs and games can hide the cursor and this should tell you whether or not that’s the case. This can’t be used for individual mice. Use Fake Cursors for them instead.
Mouse.Cursor is equal to whatever cursor is currently being displayed. It can be the following values:
-2. Wii Hand
Size Diagonal /
Size Vertical |
Size Diagonal \
Size Horizontal –
Symbol for no
Arrow + Hourglass (Application starting)
Arrow + ? (Help)
Size All +
Symbol for no again
99. None of the above
Setting this value doesn’t really work yet, unless you keep setting it to different values like this:
Mouse.Cursor = Random(21)