1 // SuperTux - MovingSprite Base Class
2 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_OBJECT_MOVING_SPRITE_HPP
18 #define HEADER_SUPERTUX_OBJECT_MOVING_SPRITE_HPP
20 #include "object/anchor_point.hpp"
21 #include "supertux/moving_object.hpp"
22 #include "util/reader_fwd.hpp"
23 #include "video/drawing_request.hpp"
24 #include "sprite/sprite_ptr.hpp"
27 * Abstract base class for MovingObjects that are represented by a Sprite
29 class MovingSprite : public MovingObject
32 MovingSprite(const Vector& pos,
33 const std::string& sprite_name,
34 int layer = LAYER_OBJECTS,
35 CollisionGroup collision_group = COLGROUP_MOVING);
36 MovingSprite(const Reader& reader,
38 int layer = LAYER_OBJECTS,
39 CollisionGroup collision_group = COLGROUP_MOVING);
40 MovingSprite(const Reader& reader,
41 const std::string& sprite_name,
42 int layer = LAYER_OBJECTS,
43 CollisionGroup collision_group = COLGROUP_MOVING);
44 MovingSprite(const Reader& reader,
45 int layer = LAYER_OBJECTS,
46 CollisionGroup collision_group = COLGROUP_MOVING);
47 MovingSprite(const MovingSprite& moving_sprite);
48 //MovingSprite& operator=(const MovingSprite& moving_sprite);
51 virtual void draw(DrawingContext& context);
52 virtual void update(float elapsed_time);
55 std::string sprite_name;
57 int layer; /**< Sprite's z-position. Refer to video/drawing_context.hpp for sensible values. */
59 /** set new action for sprite and resize bounding box. use with
60 care as you can easily get stuck when resizing the bounding box. */
61 void set_action(const std::string& action, int loops);
63 /** set new action for sprite and re-center bounding box. use with
64 care as you can easily get stuck when resizing the bounding
66 void set_action_centered(const std::string& action, int loops);
68 /** set new action for sprite and align bounding boxes at
69 anchorPoint. use with care as you can easily get stuck when
70 resizing the bounding box. */
71 void set_action(const std::string& action, int loops, AnchorPoint anchorPoint);
74 //MovingSprite(const MovingSprite&);
75 MovingSprite& operator=(const MovingSprite&);