From dc7462af6bf6927497c7249d612895e3b8a1f03e Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sat, 17 Apr 2004 22:22:35 +0000 Subject: [PATCH] - added draw_part() SVN-Revision: 549 --- src/sprite.cpp | 10 ++++++++++ src/sprite.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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; } -- 2.11.0