[Super-tux-commit] supertux/src sprite.cpp,1.3,1.4 sprite.h,1.4,1.5
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-17 22:22:45
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29505 Modified Files: sprite.cpp sprite.h Log Message: - added draw_part() Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sprite.cpp 17 Apr 2004 10:48:04 -0000 1.3 +++ sprite.cpp 17 Apr 2004 22:22:35 -0000 1.4 @@ -71,6 +71,16 @@ } void +Sprite::draw_part(float sx, float sy, float x, float y, float w, float h) +{ + time = SDL_GetTicks(); + unsigned int frame = get_current_frame(); + + if (frame < surfaces.size()) + surfaces[frame]->draw_part(sx, sy, x - x_hotspot, y - y_hotspot, w, h); +} + +void Sprite::reset() { time = 0; Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- sprite.h 17 Apr 2004 10:48:04 -0000 1.4 +++ sprite.h 17 Apr 2004 22:22:35 -0000 1.5 @@ -55,7 +55,7 @@ /** Update the sprite and process to the next frame */ void update(float delta); void draw(float x, float y); - + void draw_part(float sx, float sy, float x, float y, float w, float h); int get_current_frame() const; std::string get_name() const { return name; } |