Amulets & Armor
v1.02
Open Source Game
|
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 |
Mouse OS interface.
Mouse to Driver interfacing.
#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 |
IMouseInstallCallback puts sets up the mouse driver to call the IMouseCallback routine every time something is moved.
MouseErase removes the mouse from the display using the hidden data.
IMouseUninstallCallback turns off the mouse driver callback capability
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.
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.
MouseCheckInstalled checks to see if a mouse is available. If there is one, TRUE is returned. If not, a FALSE is returned.
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_buttonClick MouseGetButtonStatus | ( | T_void | ) |
T_mouseEventHandler MouseGetEventHandler | ( | 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.
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).
To move the mouse to a different location, pass an X & Y position to MouseMoveTo(). The mouse will then be at that new location.
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.
mouseEventHandler | – function to call on events, or NULL for none. |
MouseSetBitmap changes the picture used for the mouse and its hotspot.
hot_spot_x | – x position for hot spot |
hot_spot_y | – y position for hot spot |
p_bitmap | – COMPRESSED Bitmap to use |
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.
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.
colorTable | – Colorization table to use |
MouseSetDefaultBitmap changes the picture's default bitmap.
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.
p_handler | – Pointer to function that will handle mouse events. Pass NULL if there is no longer an event handler. |
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.
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.
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 |
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.
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.