class MASKING_DLL_DECLSPEC Cursor

Represents an animated mouse cursor with a Windows XP style shadow

Public Methods

[more]Bitmap& Sprite() const
Returns the current mouse sprite
[more]Bitmap& Shadow() const
Returns the current mouse shadow
[more]Cursor& Create(const Bitmap &bmp, int n=1)
Creates a new mouse cursor with a shadow.
[more]Cursor& Create()
Creates a new mouse cursor with a shadow.
[more]void Destroy()
Destroys the cursor.
[more]void SetFocus(const Point &p)
[more]void SetFocus(int x, int y)
[more]const Point& GetFocus()
Get and set the focus point of cursor.
[more]void SetAnimationInterval(int i)
Effectively sets the speed of the mouse cursor animation.
[more]void Update()
Updates the animation.

Protected Fields

[more]std::vector<Bitmap *> sprite
A vector of mouse sprites.
[more]std::vector<Bitmap *> shadow
A vector of mouse shadows.
[more]static int PADDING
Effectively the intensity of the blur effect on the shadow sprites.
[more]static Color shadowColor
The color of the cursor shadow.
[more]static Point shadowOffset
The offset of the shadow relative to the main sprite.
[more]Point focus
The sprites focus point
[more]int frameCount
[more]float frame
[more]float interval
Animation specific variables.

Protected Methods

[more]void Blur(Bitmap &bmp, int radius)
Blurs the passed bitmap.
[more]void MakeShadow()
Creates a shadow sprite for every main cursor sprite of the animated cursor.
[more]static void ReadSkinData()
Reads cursor specific data from the skin config file


Documentation

Represents an animated mouse cursor with a Windows XP style shadow
ostd::vector<Bitmap *> sprite
A vector of mouse sprites. These are effectively frames of the animated sprite.

ostd::vector<Bitmap *> shadow
A vector of mouse shadows. There's a matching shadow for each frame of the sprite animation.

ostatic int PADDING
Effectively the intensity of the blur effect on the shadow sprites. It is also the number of pixels the shadow sprite must be larger than the main sprite at every edge, hence the name of the variable.

ostatic Color shadowColor
The color of the cursor shadow. Typically this is some shade of gray. A darker shade of gray produces a thicker shadow. A different color might produce a glow effect rather then a shadow.

ostatic Point shadowOffset
The offset of the shadow relative to the main sprite. Typically the shadow is just a little to the right of the main sprite.

oPoint focus
The sprites focus point

oint frameCount

ofloat frame

ofloat interval
Animation specific variables. The number of frames, the current frame and the interval bewteen frames in miliseconds.

ovoid Blur(Bitmap &bmp, int radius)
Blurs the passed bitmap. Radius is effectively the depth of the blur effect. Good values are between 1 and 4.

ovoid MakeShadow()
Creates a shadow sprite for every main cursor sprite of the animated cursor. It does so by creating a new sprite the size of the main sprite and adds a border the size of the blur depth on each side. It then clears the shadow sprite to the shadow color and makes a black and white mask in the alpha channel with black being the transparent color. Then it blurs the alpha channel. When the cursor is rendered the shadow is drawn with draw_trans_sprite().

ostatic void ReadSkinData()
Reads cursor specific data from the skin config file

oBitmap& Sprite() const
Returns the current mouse sprite

oBitmap& Shadow() const
Returns the current mouse shadow

oCursor& Create(const Bitmap &bmp, int n=1)
Creates a new mouse cursor with a shadow. This function creates the mouse cursor from the passed bitmap. The second parameter is the number of frames in the bitmap. If the number of frames is greater than 1, an animated cursor will be created by horizontally cutting the bitmap into n equally sized frames.

oCursor& Create()
Creates a new mouse cursor with a shadow. This function creates the mouse cursor from the default Allegro sprite or whatever sprite is currently loaded as the Allegro mouse sprite.

ovoid Destroy()
Destroys the cursor. After this function is called the cursor is invalid and shouldn't be used anymore.

ovoid SetFocus(const Point &p)

ovoid SetFocus(int x, int y)

oconst Point& GetFocus()
Get and set the focus point of cursor. The focus point is the point where the mouse is actually positioned relative to the top left of the cursor sprite. For a regular mouse arrow this is point [0,0] but for many other cursor sprites this may be at a different location.

ovoid SetAnimationInterval(int i)
Effectively sets the speed of the mouse cursor animation. The interval is the time between frames of animation in miliseconds.

ovoid Update()
Updates the animation. This is called by the GUI core once every frame.


This class has no child classes.
Friends:
class MASKING_DLL_DECLSPEC Mouse
class MASKING_DLL_DECLSPEC Skin

Alphabetic index Hierarchy of classes


Back to front page   |   page generated with DOC++