2 // Copyright (C) 2006 Matthias Braun <matze@braunis.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_BACKGROUND_HPP
18 #define HEADER_SUPERTUX_OBJECT_BACKGROUND_HPP
20 #include "supertux/game_object.hpp"
21 #include "util/reader_fwd.hpp"
22 #include "video/drawing_context.hpp"
26 class Background : public GameObject
30 Background(const Reader& reader);
31 virtual ~Background();
33 void set_image(const std::string& name, float bkgd_speed);
35 std::string get_image() const
37 float get_speed() const
40 virtual void update(float elapsed_time);
42 virtual void draw(DrawingContext& context);
46 std::string imagefile_top;
47 std::string imagefile;
48 std::string imagefile_bottom;
49 Vector pos; /**< coordinates of upper-left corner of image */
50 float speed; /**< scroll-speed in horizontal direction */
51 float speed_y; /**< scroll-speed in vertical direction */
52 std::auto_ptr<Surface> image_top; /**< image to draw above pos */
53 std::auto_ptr<Surface> image; /**< image to draw, anchored at pos */
54 std::auto_ptr<Surface> image_bottom; /**< image to draw below pos+screenheight */
57 #endif /*SUPERTUX_BACKGROUND_H*/