#include <sprite.h>
Definition at line 14 of file sprite.h.
Public Methods | |
Sprite (string sprname="") | |
Creates a sprite with no frames. | |
Sprite (string filename, string sprname="") | |
Creates a sprite from filename named sprname. | |
Sprite (vector< string > &filenames, string sprname="") | |
Creates a sprite using filenames. | |
Sprite (Surface *frame, string sprname="") | |
Creates a sprite from an already allocated surface. | |
Sprite (vector< Surface * > &sframes, string sprname="") | |
Creates a sprite from a series of surfaces. | |
Sprite (const Sprite &) | |
Copy Constructor. | |
virtual | ~Sprite () |
Virtual delete. | |
virtual void | animate () |
changes frame and other information | |
virtual Rect | draw (Graphics &) |
knows how to draw to a graphics context | |
virtual Rect | draw (Surface *) |
Knows how to draw to a surface. | |
void | ReverseAnimation (bool) |
void | EnableAnimation (bool) |
Enable/Disable animation. | |
void | ToggleAnimation () |
Toggles animation. | |
void | SetAnimateTime (int ms) |
Sets time per frame of animation. | |
void | SetAnimationStartFrame (int) |
delay between calling animate Sets the start frame for the animation | |
void | SetAnimationEndFrame (int) |
Sets th stop frame for the animation (should be 1 + the last). | |
void | Show (bool) |
Show/Hide the sprite. | |
void | SetFrame (int) |
Sets the frame to draw, when not in animation mode. | |
int | GetFrame () const |
Returns current frame drawn. | |
int | CountFrames () |
Returns the amount of frames for this sprite. | |
virtual int | SetPosition (double x=0.0, double y=0.0) |
Set the position of the sprite. | |
string | GetName () const |
Return the name of the sprite. | |
void | SetName (string) |
Set the name. | |
Sprite & | operator++ () |
Sprite | operator++ (int) |
Sprite & | operator-- () |
Decreases drawn frame, will loop. | |
Sprite | operator-- (int) |
Sprite & | operator= (int) |
Sets the frame to draw (calls SetFrame). | |
int | GetWidth () const |
int | GetHeight () const |
double | GetX () const |
double | GetY () const |
int | LoadFrames (vector< Surface * > &sframes) |
int | LoadFrames (vector< string > &filenames) |
int | LoadFrame (Surface *frame) |
int | LoadFrame (string filename) |
int | AddFrame (Surface *frame) |
Add functions append to the old frames vector. | |
int | AddFrame (string filename) |
int | AppendFrame (Surface *frame) |
Append functions don't duplicate existing memory. | |
bool | RemoveFrame (int) |
Removes the frame at position. | |
bool | EmptyFrames () |
Frees all frames. | |
Static Public Attributes | |
SpriteCache | cache |
Protected Methods | |
void | init () |
More Utilities. | |
void | close () |
Private Attributes | |
vector< Surface * > | frames |
bool | free_frames_on_exit |
unsigned int | current_frame |
double | x |
double | y |
int | w |
int | h |
string | name |
Name of the sprite. | |
bool | visible |
Optional name for the sprite. | |
Sprite::_animinfo | animinfo |
|
Creates a sprite with no frames.
Definition at line 13 of file sprite.cpp. |
|
Creates a sprite from filename named sprname.
Definition at line 21 of file sprite.cpp. References init(), LoadFrame(), and SetName(). |
|
Creates a sprite using filenames.
Definition at line 31 of file sprite.cpp. References init(), LoadFrames(), and SetName(). |
|
Creates a sprite from an already allocated surface.
Definition at line 41 of file sprite.cpp. References init(), LoadFrame(), and SetName(). |
|
Creates a sprite from a series of surfaces.
Definition at line 51 of file sprite.cpp. References init(), LoadFrames(), and SetName(). |
|
Copy Constructor.
Definition at line 61 of file sprite.cpp. |
|
Virtual delete.
Definition at line 68 of file sprite.cpp. References close(). |
|
Definition at line 375 of file sprite.cpp. References cache, SpriteCache::Find(), and frames. |
|
Add functions append to the old frames vector.
Definition at line 361 of file sprite.cpp. References frames. Referenced by LoadFrame(), and LoadFrames(). |
|
changes frame and other information
Definition at line 103 of file sprite.cpp. References animinfo, current_frame, Sprite::_animinfo::delay, Sprite::_animinfo::enabled, Sprite::_animinfo::end_frame, Sprite::_animinfo::lastanimtime, Sprite::_animinfo::reverse, SetFrame(), Sprite::_animinfo::start_frame, and Util_TimePassed(). |
|
Append functions don't duplicate existing memory.
|
|
Definition at line 90 of file sprite.cpp. References EmptyFrames(), and frames. Referenced by ~Sprite(). |
|
Returns the amount of frames for this sprite.
Definition at line 250 of file sprite.cpp. References frames. Referenced by operator++(), operator--(), and Crosshair::think(). |
|
Knows how to draw to a surface.
Definition at line 148 of file sprite.cpp. References Graphics::blit(), current_frame, frames, GetX(), GetY(), h, Rect, visible, and w. |
|
knows how to draw to a graphics context
Definition at line 127 of file sprite.cpp. References Graphics::blit(), current_frame, frames, GetX(), GetY(), h, Rect, visible, and w. |
|
Frees all frames.
Definition at line 401 of file sprite.cpp. References frames, and Graphics::freeImage(). Referenced by close(), LoadFrame(), and LoadFrames(). |
|
Enable/Disable animation.
Definition at line 181 of file sprite.cpp. References animinfo, Sprite::_animinfo::enabled, Sprite::_animinfo::lastanimtime, and Util_GetTime(). Referenced by Bear::Bear(), init(), Bear::setWalk(), MainChar::setWalking(), and ToggleAnimation(). |
|
Returns current frame drawn.
Definition at line 243 of file sprite.cpp. References current_frame. Referenced by operator++(), operator--(), Crosshair::SetPosition(), MainChar::setWalking(), and Crosshair::think(). |
|
Definition at line 104 of file sprite.h. References w. Referenced by GameObject::GetBoundingRect(), GameObject::Recenter(), MainChar::Recenter(), Crosshair::Recenter(), MainChar::setLook(), and Bear::setWalk(). |
|
Return the name of the sprite.
Definition at line 257 of file sprite.cpp. References name. |
|
Definition at line 103 of file sprite.h. Referenced by MainChar::FireWeapon(), GameObject::GetBoundingRect(), MainChar::Recenter(), Crosshair::Recenter(), MainChar::setLook(), and Bear::setWalk(). |
|
Definition at line 105 of file sprite.h. References h. Referenced by draw(), GameObject::GetBoundingRect(), MainChar::setLook(), and Bear::setWalk(). |
|
Definition at line 106 of file sprite.h. References x. Referenced by draw(), GameObject::GetBoundingRect(), MainChar::setLook(), and Bear::setWalk(). |
|
More Utilities.
Definition at line 73 of file sprite.cpp. References EnableAnimation(), frames, free_frames_on_exit, SetFrame(), SetPosition(), and Show(). Referenced by Sprite(). |
|
Definition at line 355 of file sprite.cpp. References AddFrame(), and EmptyFrames(). |
|
Definition at line 349 of file sprite.cpp. References AddFrame(), and EmptyFrames(). Referenced by Sprite(). |
|
Definition at line 337 of file sprite.cpp. References AddFrame(), and EmptyFrames(). |
|
Loads frames in different manners Load* functions destroy the old frames vector Definition at line 325 of file sprite.cpp. References AddFrame(), and EmptyFrames(). Referenced by Sprite(). |
|
Definition at line 282 of file sprite.cpp. References CountFrames(), GetFrame(), and SetFrame(). |
|
Operators Increases drawn frame, will loop frames Definition at line 275 of file sprite.cpp. References CountFrames(), GetFrame(), and SetFrame(). |
|
Definition at line 301 of file sprite.cpp. References CountFrames(), GetFrame(), and SetFrame(). |
|
Decreases drawn frame, will loop.
Definition at line 291 of file sprite.cpp. References CountFrames(), GetFrame(), and SetFrame(). |
|
Sets the frame to draw (calls SetFrame).
Definition at line 314 of file sprite.cpp. References SetFrame(). |
|
Removes the frame at position.
Definition at line 387 of file sprite.cpp. References frames, and Graphics::freeImage(). |
|
Utility functions Enable/Disable reverse animation Definition at line 174 of file sprite.cpp. References animinfo, and Sprite::_animinfo::reverse. Referenced by Bear::Bear(), Bear::setWalk(), and MainChar::setWalking(). |
|
Sets time per frame of animation.
Definition at line 200 of file sprite.cpp. References animinfo, and Sprite::_animinfo::delay. Referenced by Bear::Bear(), MainChar::MainChar(), and Bear::setWalk(). |
|
Sets th stop frame for the animation (should be 1 + the last).
Definition at line 214 of file sprite.cpp. References animinfo, and Sprite::_animinfo::end_frame. Referenced by Bear::Bear(), Bear::setWalk(), and MainChar::setWalking(). |
|
delay between calling animate Sets the start frame for the animation
Definition at line 207 of file sprite.cpp. References animinfo, and Sprite::_animinfo::start_frame. Referenced by Bear::Bear(), Bear::setWalk(), and MainChar::setWalking(). |
|
Sets the frame to draw, when not in animation mode.
Definition at line 225 of file sprite.cpp. References current_frame, frames, h, and w. Referenced by animate(), Bear::Bear(), MainChar::ChangeDirection(), Crosshair::Crosshair(), init(), MainChar::MainChar(), operator++(), operator--(), operator=(), UFO::SetupDirection(), Bear::setWalk(), and MainChar::setWalking(). |
|
Set the name.
Definition at line 264 of file sprite.cpp. References name. Referenced by Sprite(). |
|
Set the position of the sprite.
Definition at line 235 of file sprite.cpp. Referenced by init(), GameObject::Recenter(), MainChar::Recenter(), and Crosshair::Recenter(). |
|
Show/Hide the sprite.
Definition at line 219 of file sprite.cpp. References visible. Referenced by init(). |
|
Toggles animation.
Definition at line 193 of file sprite.cpp. References animinfo, EnableAnimation(), and Sprite::_animinfo::enabled. |
|
Referenced by animate(), EnableAnimation(), ReverseAnimation(), SetAnimateTime(), SetAnimationEndFrame(), SetAnimationStartFrame(), and ToggleAnimation(). |
|
Definition at line 6 of file sprite.cpp. Referenced by AddFrame(), and Util_parseImage(). |
|
Definition at line 138 of file sprite.h. Referenced by animate(), draw(), GetFrame(), and SetFrame(). |
|
Definition at line 135 of file sprite.h. Referenced by AddFrame(), close(), CountFrames(), draw(), EmptyFrames(), init(), RemoveFrame(), and SetFrame(). |
|
Definition at line 136 of file sprite.h. Referenced by init(). |
|
Definition at line 140 of file sprite.h. Referenced by draw(), GetX(), and SetFrame(). |
|
Name of the sprite.
|
|
Optional name for the sprite.
|
|
Definition at line 140 of file sprite.h. Referenced by draw(), GetHeight(), and SetFrame(). |
|
Definition at line 139 of file sprite.h. Referenced by GetY(), and SetPosition(). |
|
Definition at line 139 of file sprite.h. Referenced by SetPosition(). |