class MASKING_DLL_DECLSPEC Cursor
Represents an animated mouse cursor with a Windows XP style shadow
Public Methods
-
Bitmap& Sprite() const
- Returns the current mouse sprite
-
Bitmap& Shadow() const
- Returns the current mouse shadow
-
Cursor& Create(const Bitmap &bmp, int n=1)
- Creates a new mouse cursor with a shadow.
-
Cursor& Create()
- Creates a new mouse cursor with a shadow.
-
void Destroy()
- Destroys the cursor.
-
void SetFocus(const Point &p)
-
void SetFocus(int x, int y)
-
const Point& GetFocus()
- Get and set the focus point of cursor.
-
void SetAnimationInterval(int i)
- Effectively sets the speed of the mouse cursor animation.
-
void Update()
- Updates the animation.
Protected Fields
-
std::vector<Bitmap *> sprite
- A vector of mouse sprites.
-
std::vector<Bitmap *> shadow
- A vector of mouse shadows.
-
static int PADDING
- Effectively the intensity of the blur effect on the shadow sprites.
-
static Color shadowColor
- The color of the cursor shadow.
-
static Point shadowOffset
- The offset of the shadow relative to the main sprite.
-
Point focus
- The sprites focus point
-
int frameCount
-
float frame
-
float interval
- Animation specific variables.
Protected Methods
-
void Blur(Bitmap &bmp, int radius)
- Blurs the passed bitmap.
-
void MakeShadow()
- Creates a shadow sprite for every main cursor sprite of the animated cursor.
-
static void ReadSkinData()
- Reads cursor specific data from the skin config file
Documentation
Represents an animated mouse cursor with a Windows XP style shadow
std::vector<Bitmap *> sprite
-
A vector of mouse sprites.
These are effectively frames of the animated sprite.
std::vector<Bitmap *> shadow
-
A vector of mouse shadows.
There's a matching shadow for each frame of the sprite animation.
static 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.
static 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.
static 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.
Point focus
-
The sprites focus point
int frameCount
float frame
float interval
-
Animation specific variables.
The number of frames, the current frame and the interval bewteen frames in miliseconds.
void 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.
void 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().
static void ReadSkinData()
-
Reads cursor specific data from the skin config file
Bitmap& Sprite() const
-
Returns the current mouse sprite
Bitmap& Shadow() const
-
Returns the current mouse shadow
Cursor& 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.
Cursor& 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.
void Destroy()
-
Destroys the cursor.
After this function is called the cursor is invalid and shouldn't be
used anymore.
void SetFocus(const Point &p)
void SetFocus(int x, int y)
const 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.
void SetAnimationInterval(int i)
-
Effectively sets the speed of the mouse cursor animation.
The interval is the time between frames of animation in miliseconds.
void 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++