class MASKING_DLL_DECLSPEC Mouse
The mouse input handling class.
Public Fields
-
Point pos
- The current position of the mouse cursor on the screen.
-
int flags
- The state of the mouse buttons.
-
int z
- The current position of the mouse wheel.
Public Methods
-
void SetParent(ScreenUpdate* p)
- Sets the mouse's parent screen zpdate driver.
-
virtual void SetCursor(Cursor &cur)
- Changes the current mouse cursor.
-
virtual Cursor* GetCursor()
- Returns a pointer to the currently active cursor
-
virtual void Show()
- Draws the cursor to the canvas.
-
virtual void Hide()
- Hides the mouse cursor.
-
virtual void Update()
- Updates the cursor (which can be animated) and the mouse position
Protected Fields
-
Cursor* cur
- A pointer to the currently selected cursor
-
Bitmap back
- The stored background of the cursor
-
Point spritePos
- Position of the main cursor sprite
-
Point shadowPos
- Position of the cursor shadow
-
Point backPos
- Position of the stored background
-
ScreenUpdate* parent
- A pointer to the screen update driver (canvas)
-
bool hidden
- True when the mouse cursor is hidden, false otherwise
Protected Methods
-
virtual void Destroy()
- Cleans up when the mouse functionality is no longer needed (ie.
-
virtual void UpdateState()
- Updates the state of the mouse system.
-
virtual void CalculateGeometry()
- Calculates the relative positions of the main cursor sprite, its shadow and the background
Documentation
The mouse input handling class.
The mouse system is quite simple in MASkinG and there's lots of room for
optimization. The mouse class hold variables for the current mouse position,
cursor and the background of the cursor. The user is required to hide the
mouse before every drawing operation and then show it again when they're
finished. Actually the dialog manager does this already so you don't really
need to worry about it. In fact you don't need to know this class even exists
as the dialog manager either does all work for you or provides its own
interface for doing things like changing the mouse cursor and so on.
Cursor* cur
-
A pointer to the currently selected cursor
Bitmap back
-
The stored background of the cursor
Point spritePos
-
Position of the main cursor sprite
Point shadowPos
-
Position of the cursor shadow
Point backPos
-
Position of the stored background
ScreenUpdate* parent
-
A pointer to the screen update driver (canvas)
bool hidden
-
True when the mouse cursor is hidden, false otherwise
virtual void Destroy()
-
Cleans up when the mouse functionality is no longer needed (ie. at the end of the program).
virtual void UpdateState()
-
Updates the state of the mouse system.
This includes the position, button states and wheel position. The default
driver simply mirrors the global Allegro mouse variables (mouse_x, mouse_y,
mouse_b and mouse_z). If you want to modify the bahaviour of your mouse
you should derive a new class from Mouse and overload this function so that
it does whatever you want. For example you might want to invert the left and
right buttons.
virtual void CalculateGeometry()
-
Calculates the relative positions of the main cursor sprite, its shadow and the background
void SetParent(ScreenUpdate* p)
-
Sets the mouse's parent screen zpdate driver.
This lets the mouse know who to ask to get the canvas bitmap
where it can draw itself.
virtual void SetCursor(Cursor &cur)
-
Changes the current mouse cursor. First it hides the cursor, then
makes the switch and the shows the new one.
virtual Cursor* GetCursor()
-
Returns a pointer to the currently active cursor
virtual void Show()
-
Draws the cursor to the canvas. Prior to that it makes a backup of what
is behind the cursor so it is vital that the mouse has been hidden before
calling this function.
virtual void Hide()
-
Hides the mouse cursor. It does so by restoring the previously saved backup
of the cursor background in place of the cursor.
virtual void Update()
-
Updates the cursor (which can be animated) and the mouse position
Point pos
-
The current position of the mouse cursor on the screen. You should always
read this value instead of relying directly on mouse_x and mouse_y. You
should not change this value.
int flags
-
The state of the mouse buttons. This variable mirrors the Allegro mouse_b
variable but you should always read this value instead of using mouse_b directly.
int z
-
The current position of the mouse wheel. Always use this value instead of using
mouse_z directly.
- This class has no child classes.
Alphabetic index Hierarchy of classes
Back to front page
|
page generated with DOC++