Sprite Class Reference

#include <sprite.h>

Collaboration diagram for Sprite:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Sprite ()
 Sprite (Surface surface)
 Sprite (const Sprite &other)
void Init (Surface &surface, const Point2i &frameSize, int nb_frames_x, int nb_frames_y)
Surface GetSurface ()
unsigned int GetCurrentFrame () const
void SetCurrentFrame (unsigned int frame_no)
unsigned int GetFrameCount ()
unsigned int GetWidth () const
unsigned int GetWidthMax () const
unsigned int GetHeight () const
unsigned int GetHeightMax () const
Point2i GetSize () const
Point2i GetSizeMax () const
void GetScaleFactors (float &scale_x, float &scale_y)
void SetSize (unsigned int w, unsigned int h)
void SetSize (const Point2i &size)
void Scale (float scale_x, float scale_y)
void ScaleSize (int width, int height)
void ScaleSize (Point2i size)
void SetRotation_rad (double angle_rad)
const double & GetRotation_rad ()
void SetRotation_HotSpot (const Point2i new_hotspot)
void SetRotation_HotSpot (const Rotation_HotSpot rhs)
const Point2iGetRotationPoint ()
SpriteFrameoperator[] (unsigned int frame_no)
const SpriteFrameoperator[] (unsigned int frame_no) const
const SpriteFrameGetCurrentFrameObject () const
void AddFrame (const Surface &surf, unsigned int delay=100)
void SetFrameSpeed (unsigned int nv_fs)
void Start ()
void Update ()
void Finish ()
bool IsFinished () const
void SetAlpha (float alpha)
float GetAlpha ()
void EnableRotationCache (unsigned int cache_size)
void EnableFlippingCache ()
void Show ()
void Hide ()
void Blit (Surface &dest, uint pox_x, uint pos_y)
void Blit (Surface &dest, const Point2i &pos)
void Blit (Surface &dest, const Rectanglei &srcRect, const Point2i &destPos)
void Blit (Surface &dest, int pox_x, int pos_y, int src_x, int src_y, uint w, uint h)
void Draw (const Point2i &pos)
void DrawXY (const Point2i &pos)
void RefreshSurface ()

Public Attributes

SpriteCache cache
SpriteAnimation animation

Private Member Functions

void Constructor ()
void Calculate_Rotation_Offset (Surface &tmp_surface)

Private Attributes

Surface current_surface
bool show
unsigned int current_frame
int frame_width_pix
int frame_height_pix
std::vector< SpriteFrameframes
float alpha
float scale_x
float scale_y
double rotation_rad
Point2i rhs_pos
Rotation_HotSpot rot_hotspot
Point2i rotation_point

Detailed Description

Definition at line 48 of file sprite.h.


Constructor & Destructor Documentation

Sprite::Sprite (  )  [explicit]

Definition at line 39 of file sprite.cpp.

00039                :
00040   cache(*this),
00041   animation(*this)
00042 {
00043   Constructor();
00044 }

Here is the call graph for this function:

Sprite::Sprite ( Surface  surface  )  [explicit]

Definition at line 46 of file sprite.cpp.

00046                                 :
00047   cache(*this),
00048   animation(*this)
00049 {
00050    Constructor();
00051    frame_width_pix = surface.GetWidth();
00052    frame_height_pix = surface.GetHeight();
00053    frames.push_back( SpriteFrame(surface));
00054 }

Here is the call graph for this function:

Sprite::Sprite ( const Sprite other  ) 

Definition at line 56 of file sprite.cpp.

00056                                   :
00057   cache(*this),
00058   animation(other.animation,*this)
00059 {
00060   frame_width_pix = other.frame_width_pix;
00061   frame_height_pix = other.frame_height_pix;
00062   scale_x = other.scale_x;
00063   scale_y = other.scale_y;
00064   alpha = other.alpha;
00065   rotation_rad = other.rotation_rad;
00066   current_frame = other.current_frame;
00067   rot_hotspot = other.rot_hotspot;
00068   show = other.show;
00069 
00070   for(unsigned int f=0;f<other.frames.size();f++)
00071     AddFrame(other.frames[f].surface,other.frames[f].delay);
00072 }

Here is the call graph for this function:


Member Function Documentation

void Sprite::AddFrame ( const Surface surf,
unsigned int  delay = 100 
)

Definition at line 102 of file sprite.cpp.

00102                                                             {
00103           frames.push_back( SpriteFrame(surf, delay) );
00104 }

Here is the caller graph for this function:

void Sprite::Blit ( Surface dest,
int  pox_x,
int  pos_y,
int  src_x,
int  src_y,
uint  w,
uint  h 
)

Definition at line 325 of file sprite.cpp.

00325                                                                                            {
00326   if (!show)
00327         return;
00328 
00329   RefreshSurface();
00330 
00331   Rectanglei srcRect (src_x, src_y, w, h);
00332   Rectanglei dstRect (pos_x + rotation_point.x, pos_y + rotation_point.y, w, h);
00333 
00334   if(alpha == 1.0)
00335     dest.Blit(current_surface, srcRect, dstRect.GetPosition());
00336   else
00337   {
00338     Surface surf_alpha;
00339     surf_alpha.NewSurface(srcRect.GetSize(),SDL_SWSURFACE,false);
00340     surf_alpha.Blit(dest,dstRect,Point2i(0,0));
00341     surf_alpha.SetAlpha(SDL_SRCALPHA, (int)(alpha * 255.0));
00342     surf_alpha.Blit(current_surface,srcRect,Point2i(0,0));
00343     dest.Blit(surf_alpha, srcRect, dstRect.GetPosition());
00344   }
00345 
00346   // For the cache mechanism
00347   if( Game::GetInstance()->IsGameLaunched() )
00348     world.ToRedrawOnScreen( dstRect );
00349 }

Here is the call graph for this function:

void Sprite::Blit ( Surface dest,
const Rectanglei srcRect,
const Point2i destPos 
)

Definition at line 321 of file sprite.cpp.

00321                                                                                   {
00322         Blit(dest, destPos.GetX(), destPos.GetY(), srcRect.GetPositionX(), srcRect.GetPositionY(), srcRect.GetSizeX(), srcRect.GetSizeY() );
00323 }

Here is the call graph for this function:

void Sprite::Blit ( Surface dest,
const Point2i pos 
)

Definition at line 317 of file sprite.cpp.

00317                                                    {
00318         Blit(dest, pos.GetX(), pos.GetY());
00319 }

Here is the call graph for this function:

void Sprite::Blit ( Surface dest,
uint  pox_x,
uint  pos_y 
)

Definition at line 312 of file sprite.cpp.

00312                                                        {
00313   RefreshSurface();
00314     Blit(dest, pos_x, pos_y, 0, 0, current_surface.GetWidth(), current_surface.GetHeight());
00315 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Calculate_Rotation_Offset ( Surface tmp_surface  )  [private]

Definition at line 242 of file sprite.cpp.

00242                                                           {
00243   const SpriteFrame& frame = GetCurrentFrameObject();
00244   const Surface &surface = frame.surface;
00245   // Calculate offset of the depending on hotspot rotation position :
00246 
00247   int surfaceHeight = surface.GetHeight();
00248   int surfaceWidth = surface.GetWidth();
00249 
00250   //Do as if hotspot is center of picture:
00251   rotation_point.x = surfaceWidth  / 2 - tmp_surface.GetWidth()  / 2;
00252   rotation_point.y = surfaceHeight / 2 - tmp_surface.GetHeight() / 2;
00253 
00254   if(rot_hotspot == center)
00255       return;
00256 
00257   if(rot_hotspot != user_defined)
00258   {
00259     switch(rot_hotspot)
00260     {
00261     case top_left:      rhs_pos = Point2i( 0,              0);               break;
00262     case top_center:    rhs_pos = Point2i( surfaceWidth/2, 0);               break;
00263     case top_right:     rhs_pos = Point2i( surfaceWidth,   0);               break;
00264     case left_center:   rhs_pos = Point2i( 0,              surfaceHeight/2); break;
00265     case center:        rhs_pos = Point2i( surfaceWidth/2, surfaceHeight/2); break;
00266     case right_center:  rhs_pos = Point2i( surfaceWidth,   surfaceHeight/2); break;
00267     case bottom_left:   rhs_pos = Point2i( 0,              surfaceHeight);   break;
00268     case bottom_center: rhs_pos = Point2i( surfaceWidth/2, surfaceHeight);   break;
00269     case bottom_right:  rhs_pos = Point2i( surfaceWidth,   surfaceHeight);   break;
00270     default:
00271       assert(false);
00272     }
00273   }
00274 
00275   Point2i rhs_pos_tmp;
00276   rhs_pos_tmp.x = static_cast<uint>(rhs_pos.x * scale_x);
00277   rhs_pos_tmp.y = static_cast<uint>(rhs_pos.y * scale_y);
00278   surfaceWidth  = static_cast<uint>(surfaceWidth  * scale_x);
00279   surfaceHeight = static_cast<uint>(surfaceHeight * scale_y);
00280 
00281   //Calculate the position of the hotspot after a rotation around the center of the surface:
00282   float rhs_dst; //Distance between center of the sprite and the hotspot
00283   double rhs_angle; //Angle of the hotspot _before_ the rotation
00284 
00285   rhs_dst = sqrt(float((surfaceWidth /2 - rhs_pos_tmp.x)*(surfaceWidth /2 - rhs_pos_tmp.x)
00286                      + (surfaceHeight/2 - rhs_pos_tmp.y)*(surfaceHeight/2 - rhs_pos_tmp.y)));
00287 
00288   if( rhs_dst == 0.0)
00289     rhs_angle = 0.0;
00290   else
00291     rhs_angle = - acos ( float(rhs_pos_tmp.x - surfaceWidth/2) / rhs_dst );
00292 
00293   if(surfaceHeight/2 - rhs_pos.y < 0) rhs_angle = -rhs_angle;
00294 
00295   rhs_angle += rotation_rad;
00296 
00297   Point2i rhs_new_pos =  Point2i(surfaceWidth /2 + static_cast<uint>(cos(rhs_angle) * rhs_dst),
00298                                  surfaceHeight/2 + static_cast<uint>(sin(rhs_angle) * rhs_dst));
00299 
00300   rotation_point.x -= rhs_new_pos.x;
00301   rotation_point.y -= rhs_new_pos.y;
00302   rotation_point.x += rhs_pos_tmp.x;
00303   rotation_point.y += rhs_pos_tmp.y;
00304 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Constructor (  )  [private]

Definition at line 74 of file sprite.cpp.

00074                          {
00075   show = true;
00076   current_frame = 0;
00077   frame_width_pix = frame_height_pix = 0;
00078   alpha = 1.0f;
00079   scale_x = scale_y = 1.0f;
00080   rotation_rad = 0.0f;
00081   SetRotation_HotSpot(center);
00082 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Draw ( const Point2i pos  ) 

Definition at line 373 of file sprite.cpp.

00373                                    {
00374   DrawXY(pos - camera.GetPosition());
00375 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::DrawXY ( const Point2i pos  ) 

Definition at line 377 of file sprite.cpp.

00377                                      {
00378   if( !show )
00379     return;
00380 
00381   Blit(AppWormux::GetInstance()->video.window, pos);
00382 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::EnableFlippingCache (  ) 

Definition at line 392 of file sprite.cpp.

00392                                  {
00393   cache.EnableFlippingCache(frames);
00394 }

Here is the call graph for this function:

void Sprite::EnableRotationCache ( unsigned int  cache_size  ) 

Definition at line 388 of file sprite.cpp.

00388                                                         {
00389   cache.EnableRotationCache(frames, cache_size);
00390 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Finish (  ) 

Definition at line 351 of file sprite.cpp.

00351                    {
00352   animation.Finish();
00353   switch(animation.GetShowOnFinish())
00354   {
00355   case SpriteAnimation::show_first_frame:
00356     current_frame = 0;
00357     break;
00358   case SpriteAnimation::show_blank:
00359     show = false;
00360     break;
00361   default:
00362   case SpriteAnimation::show_last_frame:
00363     current_frame = frames.size()-1;
00364     break;
00365   }
00366   cache.InvalidLastFrame();
00367 }

Here is the call graph for this function:

float Sprite::GetAlpha (  ) 

Definition at line 210 of file sprite.cpp.

00210                       {
00211   return alpha;
00212 }

unsigned int Sprite::GetCurrentFrame (  )  const

Definition at line 159 of file sprite.cpp.

00159                                           {
00160   assert(current_frame < frames.size());
00161   return current_frame;
00162 }

Here is the caller graph for this function:

const SpriteFrame & Sprite::GetCurrentFrameObject (  )  const

Definition at line 172 of file sprite.cpp.

00172                                                       {
00173    return frames[current_frame];
00174 }

Here is the caller graph for this function:

unsigned int Sprite::GetFrameCount (  ) 

Definition at line 146 of file sprite.cpp.

00146                                   {
00147    return frames.size();
00148 }

Here is the caller graph for this function:

unsigned int Sprite::GetHeight (  )  const

Definition at line 127 of file sprite.cpp.

00127                                     {
00128    return static_cast<uint>(frame_height_pix * (scale_y>0?scale_y:-scale_y));
00129 }

Here is the caller graph for this function:

unsigned int Sprite::GetHeightMax (  )  const

Definition at line 131 of file sprite.cpp.

00131                                        {
00132   if(!current_surface.IsNull() )
00133     return current_surface.GetHeight();
00134   else
00135     return GetHeight();
00136 }

Here is the call graph for this function:

Here is the caller graph for this function:

const double & Sprite::GetRotation_rad (  ) 

Definition at line 226 of file sprite.cpp.

00227 {
00228   assert(rotation_rad > -2*M_PI && rotation_rad <= 2*M_PI);
00229   return rotation_rad;
00230 }

Here is the caller graph for this function:

const Point2i& Sprite::GetRotationPoint (  )  [inline]

Definition at line 89 of file sprite.h.

00089 { return rotation_point; };

Here is the caller graph for this function:

void Sprite::GetScaleFactors ( float &  scale_x,
float &  scale_y 
)

Definition at line 193 of file sprite.cpp.

00193                                                            {
00194    scale_x = this->scale_x;
00195    scale_y = this->scale_y;
00196 }

Here is the caller graph for this function:

Point2i Sprite::GetSize (  )  const

Definition at line 138 of file sprite.cpp.

00138                              {
00139         return Point2i(GetWidth(), GetHeight());
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:

Point2i Sprite::GetSizeMax (  )  const

Definition at line 142 of file sprite.cpp.

00142                                 {
00143         return Point2i(GetWidthMax(), GetHeightMax());
00144 }

Here is the call graph for this function:

Here is the caller graph for this function:

Surface Sprite::GetSurface (  ) 

Definition at line 481 of file sprite.cpp.

00481                            {
00482   assert ( !current_surface.IsNull() );
00483   return current_surface;
00484 }

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Sprite::GetWidth (  )  const

Definition at line 116 of file sprite.cpp.

00116                                    {
00117    return static_cast<uint>(frame_width_pix * (scale_x>0?scale_x:-scale_x));
00118 }

Here is the caller graph for this function:

unsigned int Sprite::GetWidthMax (  )  const

Definition at line 120 of file sprite.cpp.

00120                                       {
00121   if(!current_surface.IsNull() )
00122     return current_surface.GetWidth();
00123   else
00124     return GetWidth();
00125 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Hide (  ) 

Definition at line 385 of file sprite.cpp.

00385 { show = false; }

void Sprite::Init ( Surface surface,
const Point2i frameSize,
int  nb_frames_x,
int  nb_frames_y 
)

Definition at line 84 of file sprite.cpp.

00084                                                                                              {
00085    Point2i f;
00086 
00087    this->frame_width_pix = frameSize.x;
00088    this->frame_height_pix = frameSize.y;
00089 
00090    surface.SetAlpha( 0, 0);
00091 
00092    for( f.y = 0; f.y < nb_frames_y; f.y++)
00093      for( f.x = 0; f.x < nb_frames_x; f.x++){
00094        Surface new_surf = Surface(frameSize, SDL_SWSURFACE|SDL_SRCALPHA, true);
00095        Rectanglei sr(f * frameSize, frameSize);
00096 
00097        new_surf.Blit( surface, sr, Point2i(0, 0));
00098        frames.push_back( SpriteFrame(new_surf));
00099      }
00100 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool Sprite::IsFinished (  )  const

Definition at line 386 of file sprite.cpp.

00386 { return animation.IsFinished(); }

Here is the call graph for this function:

Here is the caller graph for this function:

const SpriteFrame & Sprite::operator[] ( unsigned int  frame_no  )  const

Definition at line 168 of file sprite.cpp.

00168                                                               {
00169   return frames.at(index);
00170 }

SpriteFrame & Sprite::operator[] ( unsigned int  frame_no  ) 

Definition at line 164 of file sprite.cpp.

00164                                                   {
00165   return frames.at(index);
00166 }

void Sprite::RefreshSurface (  ) 

Definition at line 396 of file sprite.cpp.

00397 {
00398   current_surface.Free();
00399 
00400   if(!cache.have_rotation_cache && !cache.have_flipping_cache)
00401   {
00402     if(!cache.have_lastframe_cache)
00403       current_surface = frames[current_frame].surface.RotoZoom(-rotation_rad, scale_x, scale_y, SMOOTHING_OFF);
00404     else
00405     {
00406       if(cache.last_frame.IsNull() )
00407       {
00408 #ifdef BUGGY_SDLGFX
00409         if(rotation_rad != 0.0 || (scale_x != 1.0 && scale_y == 1.0))
00410         {
00411           current_surface = frames[current_frame].surface.RotoZoom(-rotation_rad , scale_x, scale_y, SMOOTHING_OFF);
00412           cache.last_frame = current_surface;
00413         }
00414         else
00415         if(scale_x != 1.0 || scale_y != 1.0)
00416         {
00417 #endif
00418           current_surface = frames[current_frame].surface.RotoZoom(-rotation_rad, scale_x, scale_y, SMOOTHING_ON);
00419           cache.last_frame = current_surface;
00420 #ifdef BUGGY_SDLGFX
00421         }
00422         else
00423         {
00424           current_surface = frames[current_frame].surface;
00425           cache.last_frame.Free();
00426         }
00427 #endif
00428       }
00429       else
00430       {
00431         current_surface = cache.last_frame;
00432       }
00433     }
00434   }
00435   else
00436   {
00437     if(cache.have_flipping_cache && !cache.have_rotation_cache)
00438     {
00439       if(rotation_rad != 0.0 || scale_y != 1.0 || (scale_x != 1.0 && scale_x != -1.0))
00440       {
00441         current_surface = frames[current_frame].surface.RotoZoom( rotation_rad, scale_x, scale_y, SMOOTHING_OFF );
00442       }
00443       else
00444       if(scale_x == 1.0)
00445         current_surface = frames[current_frame].surface;
00446       else
00447         current_surface = cache.frames[current_frame].flipped_surface;
00448     }
00449     else
00450     if(!cache.have_flipping_cache && cache.have_rotation_cache)
00451     {
00452       if(scale_x != 1.0 || scale_y != 1.0)
00453         current_surface = frames[current_frame].surface.RotoZoom(rotation_rad, scale_x, scale_y, SMOOTHING_OFF);
00454       else
00455         current_surface = cache.frames[current_frame].GetSurfaceForAngle(rotation_rad);
00456     }
00457     else
00458     {
00459       //cache.have_flipping_cache==true && cache.have_rotation_cache==true
00460       if((scale_x != 1.0 && scale_x != -1.0)  || scale_y != 1.0)
00461         current_surface = frames[current_frame].surface.RotoZoom( rotation_rad, scale_x, scale_y, SMOOTHING_OFF);
00462       else
00463       {
00464         //Scale_y == 1.0
00465         if(scale_x == 1.0)
00466           current_surface = cache.frames[current_frame].GetSurfaceForAngle(rotation_rad);
00467         else
00468           current_surface = cache.frames[current_frame].GetFlippedSurfaceForAngle(rotation_rad);
00469       }
00470     }
00471   }
00472   assert( !current_surface.IsNull() );
00473 
00474   // Calculate offset of the sprite depending on hotspot rotation position :
00475   rotation_point.x=0;
00476   rotation_point.y=0;
00477   if(rot_hotspot != center || rotation_rad!=0.0)
00478     Calculate_Rotation_Offset(current_surface);
00479 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Scale ( float  scale_x,
float  scale_y 
)

Definition at line 176 of file sprite.cpp.

00176                                                {
00177    if(this->scale_x == scale_x && this->scale_y == scale_y)
00178            return;
00179    this->scale_x = scale_x;
00180    this->scale_y = scale_y;
00181    cache.InvalidLastFrame();
00182 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::ScaleSize ( Point2i  size  ) 

Definition at line 189 of file sprite.cpp.

00189                                   {
00190         ScaleSize(size.x, size.y);
00191 }

Here is the call graph for this function:

void Sprite::ScaleSize ( int  width,
int  height 
)

Definition at line 184 of file sprite.cpp.

00184                                            {
00185   Scale(float(width)/float(frame_width_pix),
00186         float(height)/float(frame_height_pix));
00187 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::SetAlpha ( float  alpha  ) 

Definition at line 203 of file sprite.cpp.

00203                                  {
00204   assert(alpha >= 0.0 && alpha <= 1.0);
00205   if(this->alpha == alpha)
00206     return;
00207   this->alpha = alpha;
00208 }

Here is the caller graph for this function:

void Sprite::SetCurrentFrame ( unsigned int  frame_no  ) 

Definition at line 150 of file sprite.cpp.

00150                                                   {
00151   assert (frame_no < frames.size());
00152   if (current_frame != frame_no) {
00153     cache.InvalidLastFrame();
00154     MSG_DEBUG("sprite", "Set current frame : %d", frame_no);
00155   }
00156   current_frame = frame_no;
00157 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::SetFrameSpeed ( unsigned int  nv_fs  ) 

Definition at line 198 of file sprite.cpp.

00198                                             {
00199    for ( unsigned int f = 0 ; f < frames.size() ; f++)
00200      frames[f].delay = nv_fs;
00201 }

Here is the caller graph for this function:

void Sprite::SetRotation_HotSpot ( const Rotation_HotSpot  rhs  )  [inline]

Definition at line 88 of file sprite.h.

00088 { rot_hotspot = rhs; };

void Sprite::SetRotation_HotSpot ( const Point2i  new_hotspot  ) 

Definition at line 232 of file sprite.cpp.

00233 {
00234   rot_hotspot = user_defined;
00235   rhs_pos = new_hotspot;
00236 
00237   if( rhs_pos.x * 2 == static_cast<int>(GetWidth()) &&
00238       rhs_pos.y * 2 == static_cast<int>(GetHeight())  )
00239     rot_hotspot = center; // avoid using Calculate_Rotation_Offset, thus avoiding a division by zero
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::SetRotation_rad ( double  angle_rad  ) 

Definition at line 214 of file sprite.cpp.

00214                                              {
00215    while(angle_rad > 2*M_PI)
00216      angle_rad -= 2 * M_PI;
00217    while(angle_rad <= -2*M_PI)
00218      angle_rad += 2 * M_PI;
00219 
00220    if(rotation_rad == angle_rad) return;
00221 
00222    rotation_rad = angle_rad;
00223    cache.InvalidLastFrame();
00224 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::SetSize ( const Point2i size  ) 

Definition at line 112 of file sprite.cpp.

00112                                        {
00113         SetSize(size.x, size.y);
00114 }

Here is the call graph for this function:

void Sprite::SetSize ( unsigned int  w,
unsigned int  h 
)

Definition at line 106 of file sprite.cpp.

00106                                                   {
00107   assert(frame_width_pix == 0 && frame_height_pix == 0)
00108         frame_width_pix = w;
00109         frame_height_pix = h;
00110 }

Here is the caller graph for this function:

void Sprite::Show (  ) 

Definition at line 384 of file sprite.cpp.

00384 { show = true; }

void Sprite::Start (  ) 

Definition at line 306 of file sprite.cpp.

00306                   {
00307    show = true;
00308    animation.Start();
00309    cache.InvalidLastFrame();
00310 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sprite::Update (  ) 

Definition at line 369 of file sprite.cpp.

00369                    {
00370   animation.Update();
00371 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

float Sprite::alpha [private]

Definition at line 136 of file sprite.h.

SpriteAnimation Sprite::animation

Definition at line 52 of file sprite.h.

SpriteCache Sprite::cache

Definition at line 51 of file sprite.h.

unsigned int Sprite::current_frame [private]

Definition at line 131 of file sprite.h.

Surface Sprite::current_surface [private]

Definition at line 128 of file sprite.h.

int Sprite::frame_height_pix [private]

Definition at line 132 of file sprite.h.

int Sprite::frame_width_pix [private]

Definition at line 132 of file sprite.h.

std::vector<SpriteFrame> Sprite::frames [private]

Definition at line 133 of file sprite.h.

Point2i Sprite::rhs_pos [private]

Definition at line 139 of file sprite.h.

Rotation_HotSpot Sprite::rot_hotspot [private]

Definition at line 140 of file sprite.h.

Point2i Sprite::rotation_point [private]

Definition at line 141 of file sprite.h.

double Sprite::rotation_rad [private]

Definition at line 138 of file sprite.h.

float Sprite::scale_x [private]

Definition at line 137 of file sprite.h.

float Sprite::scale_y [private]

Definition at line 137 of file sprite.h.

bool Sprite::show [private]

Definition at line 129 of file sprite.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:18:04 2007 for Wormux by  doxygen 1.4.7