Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
MOUSEMOD

Mouse OS interface. More...

Macros

#define MOUSE_BUTTON_LEFT   0x01 /* --------1 */
 
#define MOUSE_BUTTON_MIDDLE   0x04 /* ------1-- */
 
#define MOUSE_BUTTON_RIGHT   0x02 /* -------1- */
 
#define MOUSE_STATE_HELD   1
 
#define MOUSE_STATE_IDLE   0
 

Functions

T_void IMouseGetUpperLeft (T_word16 *p_x, T_word16 *p_y)
 
T_void IMouseInstallCallback (T_void)
 
T_void IMouseTransfer (T_word16 x, T_word16 y, T_screen from, T_screen to)
 
T_void IMouseUninstallCallback (T_void)
 
T_void MouseAllowEvents (T_void)
 
T_void MouseAllowUpdate (T_void)
 
T_void MouseBlockEvents (T_void)
 
E_Boolean MouseCheckInstalled (T_void)
 
T_void MouseDisallowUpdate (T_void)
 
T_void MouseDraw (T_void)
 
T_void MouseErase (T_void)
 
T_void MouseFinish (T_void)
 
T_void MouseGetBitmap (T_word16 *hot_spot_x, T_word16 *hot_spot_y, T_bitmap **p_bitmap)
 
T_buttonClick MouseGetButtonStatus (T_void)
 
T_mouseEventHandler MouseGetEventHandler (T_void)
 
T_void MouseHide (T_void)
 
T_void MouseInitialize (T_void)
 
E_Boolean MouseIsRelativeMode (T_void)
 
T_void MouseMoveTo (T_word16 x, T_word16 y)
 
T_void MousePopEventHandler (T_void)
 
T_void MousePushEventHandler (T_mouseEventHandler mouseEventHandler)
 
T_void MouseRelativeModeOff (T_void)
 
T_void MouseRelativeModeOn (T_void)
 
T_void MouseRelativeRead (T_sword16 *aDeltaX, T_sword16 *aDeltaY)
 
T_void MouseReleaseBounds (T_void)
 
T_void MouseSetBitmap (T_word16 hot_spot_x, T_word16 hot_spot_y, T_bitmap *p_bitmap)
 
T_void MouseSetBounds (T_word16 left, T_word16 top, T_word16 right, T_word16 bottom)
 
T_void MouseSetColorize (E_colorizeTable colorTable)
 
T_void MouseSetDefaultBitmap (T_word16 hot_spot_x, T_word16 hot_spot_y, T_bitmap *p_bitmap)
 
T_void MouseSetEventHandler (T_mouseEventHandler p_handler)
 
T_void MouseSetEventOptions (T_byte8 f_options)
 
T_void MouseSetPicture (T_word16 hot_spot_x, T_word16 hot_spot_y, T_mousePicture picture)
 
T_void MouseSetRelativeSensitivity (T_word16 sensitivity)
 
T_void MouseShow (T_void)
 
T_void MouseUpdateEvents (T_void)
 
T_void MouseUseDefaultBitmap ()
 

Detailed Description

Mouse OS interface.

Mouse to Driver interfacing.

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define MOUSE_BUTTON_LEFT   0x01 /* --------1 */
#define MOUSE_BUTTON_MIDDLE   0x04 /* ------1-- */
#define MOUSE_BUTTON_RIGHT   0x02 /* -------1- */
#define MOUSE_STATE_HELD   1
#define MOUSE_STATE_IDLE   0

Function Documentation

T_void IMouseGetUpperLeft ( T_word16 p_x,
T_word16 p_y 
)
T_void IMouseInstallCallback ( T_void  )

IMouseInstallCallback puts sets up the mouse driver to call the IMouseCallback routine every time something is moved.

T_void IMouseTransfer ( T_word16  x,
T_word16  y,
T_screen  from,
T_screen  to 
)

MouseErase removes the mouse from the display using the hidden data.

T_void IMouseUninstallCallback ( T_void  )

IMouseUninstallCallback turns off the mouse driver callback capability

T_void MouseAllowEvents ( T_void  )

Use MouseAllowEvents to allow events to occur by the mouse module. Usually MouseBlockEvents will have been called.

NOTE: You can only call this routine after MouseBlockEvents was called.

T_void MouseAllowUpdate ( T_void  )
T_void MouseBlockEvents ( T_void  )

MouseBlockEvents keeps the mouse module from sending out events. Use MouseAllowEvents to re-enable blocked events.

NOTE: You can only call this routine once before having to call MouseAllowEvents.

E_Boolean MouseCheckInstalled ( T_void  )

MouseCheckInstalled checks to see if a mouse is available. If there is one, TRUE is returned. If not, a FALSE is returned.

Returns
TRUE = Mouse driver installed FALSE= No mouse driver found
T_void MouseDisallowUpdate ( T_void  )
T_void MouseDraw ( T_void  )

MouseDraw is used to force the mouse to display on the screen.

T_void MouseErase ( T_void  )

MouseErase removes the mouse from the display using the hidden data.

T_void MouseFinish ( T_void  )

MouseFinish is called when you are done with the mouse module and no longer need it. All hooks and variables are changed to non- active mode and you can consider it no longer being used.

T_void MouseGetBitmap ( T_word16 hot_spot_x,
T_word16 hot_spot_y,
T_bitmap **  p_bitmap 
)
T_buttonClick MouseGetButtonStatus ( T_void  )
T_mouseEventHandler MouseGetEventHandler ( T_void  )
T_void MouseHide ( T_void  )

MouseHide turns off the mouse and can be called multiple times. Multiple hides require an equal number of calls to MouseShow to make the mouse reappear.

T_void MouseInitialize ( T_void  )

MouseInitialize sets up the mouse for all the different information it needs to hold. It starts up with all default options and the cursor starts up hidden.

NOTE: You can only call this routine once. Call MouseFinish first if you need to re-initialize the mouse (but you shouldn't).

E_Boolean MouseIsRelativeMode ( T_void  )
T_void MouseMoveTo ( T_word16  x,
T_word16  y 
)

To move the mouse to a different location, pass an X & Y position to MouseMoveTo(). The mouse will then be at that new location.

T_void MousePopEventHandler ( T_void  )

MousePopEventHandler restores the last handler on the stack (if there is one).

T_void MousePushEventHandler ( T_mouseEventHandler  mouseEventHandler)

MousePushEventHandler removes the old handler by placing it on a stack and sets up the new event handler. The old event handler will be restored when a call to MousePopEventHandler is called.

Parameters
mouseEventHandler– function to call on events, or NULL for none.
T_void MouseRelativeModeOff ( T_void  )
T_void MouseRelativeModeOn ( T_void  )
T_void MouseRelativeRead ( T_sword16 aDeltaX,
T_sword16 aDeltaY 
)
T_void MouseReleaseBounds ( T_void  )

MouseReleaseBounds lets the mouse now roam the whole screen.

T_void MouseSetBitmap ( T_word16  hot_spot_x,
T_word16  hot_spot_y,
T_bitmap p_bitmap 
)

MouseSetBitmap changes the picture used for the mouse and its hotspot.

Parameters
hot_spot_x– x position for hot spot
hot_spot_y– y position for hot spot
p_bitmap– COMPRESSED Bitmap to use
T_void MouseSetBounds ( T_word16  left,
T_word16  top,
T_word16  right,
T_word16  bottom 
)

MouseSetBounds declares a box area in which the mouse is not allowed to move out of.

NOTE: I don't know what happens when the mouse is outside and the box is then declared. You should probably do a MouseMoveTo after setting the bounds.

Parameters
left– Left side of box
top– top edge of box
right– Right side of box
bottom– Bottom edge of box
T_void MouseSetColorize ( E_colorizeTable  colorTable)

MouseSetColorize sets the colorization table to be used with the picture of the mouse.

NOTE: Colorize does not work with the default cursor.

Parameters
colorTable– Colorization table to use
T_void MouseSetDefaultBitmap ( T_word16  hot_spot_x,
T_word16  hot_spot_y,
T_bitmap p_bitmap 
)

MouseSetDefaultBitmap changes the picture's default bitmap.

Parameters
hot_spot_x– x position for hot spot
hot_spot_y– y position for hot spot
p_bitmap– COMPRESSED Bitmap to use
T_void MouseSetEventHandler ( T_mouseEventHandler  p_handler)

In order to use the mouse for anything, you MUST have an event handler. This handler will receive events to process each time MouseUpdateEvents() is called (but not until then).

NOTE: There is no way to tell if you are giving this routine a correct mouse event handler, so it is up to you to make sure you are doing it right.

Parameters
p_handler– Pointer to function that will handle mouse events. Pass NULL if there is no longer an event handler.
T_void MouseSetEventOptions ( T_byte8  f_options)

Several different events can be enabled and disabled. To do so, use this MouseSetEventOptions to tell what events you want the current mouse event handler to handle.

Parameters
f_options– Or'd list of MOUSE_EVENT_OPTION's
T_void MouseSetPicture ( T_word16  hot_spot_x,
T_word16  hot_spot_y,
T_mousePicture  picture 
)

MouseSetPicture is used to change the look of the mouse cursor and where it's hot spot (pointing spot) is located. Just pass to it a mouse shape pointer and the position of the hot spot.

NOTE: None. Just make sure the hot spot is within the cursor.

Parameters
hot_spot_x– left to right position of hot spot
hot_spot_y– top to bottom position of hot spot
picture– Mouse picture to use
T_void MouseSetRelativeSensitivity ( T_word16  sensitivity)
T_void MouseShow ( T_void  )

MouseShow turns on the mouse cursor. If the mouse was already on, it increments the level of showing. Therefore, it will take an equal number of MouseHide calls to turn the mouse off.

T_void MouseUpdateEvents ( T_void  )

Whenever you wish the mouse to be updated and events to be sent to the event handler (if any), call this routine.

NOTE: This routine must be called several times a second to be really efficient. I could just tie this routine in with the mouse driver, but I figured it prudent to have an upper level that controls the mouse updates.

T_void MouseUseDefaultBitmap ( void  )

MouseUseDefaultBitmap returns the mouse to its default picture.