00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_OBJECT_FLOATING_IMAGE_HPP 00018 #define HEADER_SUPERTUX_OBJECT_FLOATING_IMAGE_HPP 00019 00020 #include "object/anchor_point.hpp" 00021 #include "sprite/sprite_ptr.hpp" 00022 #include "supertux/game_object.hpp" 00023 00024 class Sprite; 00025 00026 class FloatingImage : public GameObject 00027 { 00028 public: 00029 FloatingImage(const std::string& sprite); 00030 virtual ~FloatingImage(); 00031 00032 void set_layer(int layer) { 00033 this->layer = layer; 00034 } 00035 00036 int get_layer() const { 00037 return layer; 00038 } 00039 00040 void set_pos(const Vector& pos) { 00041 this->pos = pos; 00042 } 00043 const Vector& get_pos() const { 00044 return pos; 00045 } 00046 00047 void set_anchor_point(AnchorPoint anchor) { 00048 this->anchor = anchor; 00049 } 00050 AnchorPoint get_anchor_point() const { 00051 return anchor; 00052 } 00053 00054 void set_visible(bool visible) { 00055 this->visible = visible; 00056 } 00057 bool get_visible() const { 00058 return visible; 00059 } 00060 00061 void set_action(const std::string& action); 00062 std::string get_action(); 00063 00064 void fade_in(float fadetime); 00065 void fade_out(float fadetime); 00066 00067 void update(float elapsed_time); 00068 void draw(DrawingContext& context); 00069 00070 private: 00071 SpritePtr sprite; 00072 int layer; 00073 bool visible; 00074 AnchorPoint anchor; 00075 Vector pos; 00076 float fading; 00077 float fadetime; 00078 }; 00079 00080 #endif 00081 00082 /* EOF */