Skip to content

mouselib

In Blitz mode the system does not read the mouse for the program. Mouse On makes the library read it at every vertical blank, fifty times a second on a PAL Amiga. MouseX and MouseY then give its position, clipped to the area set with MouseArea, 0,0 to 320,200 at the start, and MouseXSpeed and MouseYSpeed how far it moved. Pointer makes a sprite follow the mouse:

LoadShape 0,"pointer.iff"
GetaSprite 0,0
BLITZ
Slice 0,44,4
Mouse On
Pointer 0,0
Repeat : VWait : Until Joyb(0)

Joyb(0) of the gameiolib library reads the mouse buttons.

Based on the mouselib guide by Acid Software.

Library number 108.

Commands

Mouse

With On, the mouse is read at every vertical blank, for MouseX, MouseY, the speeds and the pointer; Off stops it. Blitz mode only.

Statement. Help text: On|Off
Arguments: .w

MouseArea

The area the mouse position stays inside, from Minx,Miny up to, but not including, Maxx,Maxy. The start value is 0,0 to 320,200.

Statement. Help text: Minx,Miny,Maxx,Maxy
Arguments: .w, .w, .w, .w

MouseX

The horizontal position of the mouse, read since Mouse On. Blitz mode only.

Function, result .q. No help text.
No arguments.

MouseXSpeed

How far the mouse moved horizontally between the last two vertical blanks; negative to the left. Blitz mode only.

Function, result .q. No help text.
No arguments.

MouseY

The vertical position of the mouse, read since Mouse On. Blitz mode only.

Function, result .q. No help text.
No arguments.

MouseYSpeed

How far the mouse moved vertically between the last two vertical blanks; negative upwards. Blitz mode only.

Function, result .q. No help text.
No arguments.

Pointer

Makes a sprite the mouse pointer, shown on the sprite channel given in the slice used at this moment; it then follows the mouse. Blitz mode only.

Statement. Help text: Sprite#,Sprite Channel
2 forms:

  • .w, .w
  • no arguments

Make the sprite and the slice first, and use Mouse On.

PositionMouse

Sets the mouse position to x,y. It is clipped to MouseArea only at the next vertical blank, if the mouse is read with Mouse On.

Statement. Help text: x,y
Arguments: .w, .w