4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "floating_image.hpp"
25 #include "object/floating_image.hpp"
26 #include "worldmap/worldmap.hpp"
31 FloatingImage::FloatingImage(const std::string& spritefile)
33 using namespace WorldMapNS;
35 floating_image = new _FloatingImage(spritefile);
36 if(Sector::current() != NULL) {
37 Sector::current()->add_object(floating_image.get());
38 } else if(WorldMap::current() != NULL) {
39 WorldMap::current()->add_object(floating_image.get());
41 throw new std::runtime_error("Neither sector nor worldmap active");
45 FloatingImage::~FloatingImage()
47 floating_image->remove_me();
51 FloatingImage::set_layer(int layer)
53 floating_image->set_layer(layer);
57 FloatingImage::get_layer()
59 return floating_image->get_layer();
63 FloatingImage::set_pos(float x, float y)
65 floating_image->set_pos(Vector(x, y));
69 FloatingImage::get_pos_x()
71 return floating_image->get_pos().x;
75 FloatingImage::get_pos_y()
77 return floating_image->get_pos().y;
81 FloatingImage::set_anchor_point(int anchor)
83 floating_image->set_anchor_point((AnchorPoint) anchor);
87 FloatingImage::get_anchor_point()
89 return (int) floating_image->get_anchor_point();
93 FloatingImage::get_visible()
95 return floating_image->get_visible();
99 FloatingImage::set_visible(bool visible)
101 floating_image->set_visible(visible);
105 FloatingImage::set_action(const std::string& action)
107 floating_image->set_action(action);
111 FloatingImage::get_action()
113 return floating_image->get_action();