From: Ingo Ruhnke Date: Sat, 17 Apr 2004 22:22:35 +0000 (+0000) Subject: - added draw_part() X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=dc7462af6bf6927497c7249d612895e3b8a1f03e;p=supertux.git - added draw_part() SVN-Revision: 549 --- diff --git a/src/sprite.cpp b/src/sprite.cpp index b5a091dbe..9d03d8392 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -71,6 +71,16 @@ Sprite::draw(float x, float y) } 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; diff --git a/src/sprite.h b/src/sprite.h index c17439614..e30bb03ff 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -55,7 +55,7 @@ class Sprite /** 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; }