1// SuperTux - Lantern
2// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
3//
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.
8//
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.
13//
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/>.
16
17#ifndef HEADER_SUPERTUX_OBJECT_LANTERN_HPP
18#define HEADER_SUPERTUX_OBJECT_LANTERN_HPP
19
20#include "object/rock.hpp"
21
22/** Lantern. A portable Light Source. */
23class Lantern final : public Rock
24{
25public:
26 Lantern(const Vector& pos);
27 Lantern(const ReaderMapping& reader);
28
29 virtual void draw(DrawingContext& context) override;
30
31 virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
32
33 virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override;
34 virtual void ungrab(MovingObject& object, Direction dir) override;
35
36 virtual std::string get_class() const override { return "lantern"; }
37 virtual std::string get_display_name() const override { return _("Lantern"); }
38
39 virtual ObjectSettings get_settings() override;
40 virtual void after_editor_set() override;
41
42 /** returns true if lamp is currently open */
43 bool is_open() const;
44
45 /** returns the lamp's color */
46 Color get_color() const { return lightcolor; }
47 void add_color(const Color& c);
48
49private:
50 Color lightcolor;
51 SpritePtr lightsprite;
52 void updateColor();
53
54private:
55 Lantern(const Lantern&) = delete;
56 Lantern& operator=(const Lantern&) = delete;
57};
58
59#endif
60
61/* EOF */
62