[Super-tux-commit] supertux/src badguy.cpp,1.99,1.100 sprite.cpp,1.13,1.14 sprite.h,1.10,1.11
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-31 13:02:46
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28560/src Modified Files: badguy.cpp sprite.cpp sprite.h Log Message: Added support for drawing effects again. We really need a include.h file with major includes, or we could just put the includes into the defines.h. Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- badguy.cpp 31 May 2004 02:40:29 -0000 1.99 +++ badguy.cpp 31 May 2004 13:02:21 -0000 1.100 @@ -984,19 +984,17 @@ if(sprite == 0) return; - sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); -#if 0 - Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right; if(dying == DYING_FALLING && physic.get_velocity_y() < 0) - sprite->draw(viewport.world2screen(Vector(base.x, base.y)), SD_VERTICAL_FLIP); + sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS, VERTICAL_FLIP); else - sprite->draw(viewport.world2screen(Vector(base.x, base.y))); -#endif + sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); - float scroll_x = context.get_translation().x; - float scroll_y = context.get_translation().y; - if(debug_mode) + if(debug_mode) // draw hotpoint + { + float scroll_x = context.get_translation().x; + float scroll_y = context.get_translation().y; fillrect(base.x - scroll_x, base.y - scroll_y, base.width, base.height, 75,0,75, 150); + } } void Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sprite.cpp 31 May 2004 02:40:30 -0000 1.13 +++ sprite.cpp 31 May 2004 13:02:21 -0000 1.14 @@ -75,7 +75,7 @@ void Sprite::draw(DrawingContext& context, const Vector& pos, int layer, - int special_drawing) + uint32_t drawing_effect) { time = SDL_GetTicks(); unsigned int frame = get_current_frame(); @@ -84,15 +84,7 @@ { Surface* surface = surfaces[frame]; -#if 0 // TODO - if(special_drawing == SD_SEMI_TRANSPARENT) - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 128); - if(special_drawing == SD_VERTICAL_FLIP) - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 255, true); - else - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot); -#endif - context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer); + context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer, drawing_effect); } } Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- sprite.h 30 May 2004 01:08:49 -0000 1.10 +++ sprite.h 31 May 2004 13:02:21 -0000 1.11 @@ -26,8 +26,6 @@ #include "screen/texture.h" #include "vector.h" -enum SpecialDrawing { SD_NONE, SD_VERTICAL_FLIP, SD_SEMI_TRANSPARENT }; - class Sprite { private: @@ -59,7 +57,7 @@ /** Update the sprite and process to the next frame */ void update(float delta); void draw(DrawingContext& context, const Vector& pos, int layer, - int special_drawing = SD_NONE); + uint32_t drawing_effect = NONE_EFFECT); int get_current_frame() const; float get_fps() { return fps; } ; |