diff options
Diffstat (limited to 'src/game/base/template.h')
-rw-r--r-- | src/game/base/template.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/game/base/template.h b/src/game/base/template.h new file mode 100644 index 0000000..47c9ff3 --- /dev/null +++ b/src/game/base/template.h @@ -0,0 +1,92 @@ +/* + base/template.h + This file is part of the Osirion project and is distributed under + the terms and conditions of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_BASE_TEMPLATE_H__ +#define __INCLUDED_BASE_TEMPLATE_H__ + +#include <list> + +#include "math/color.h" +#include "model/model.h" +#include "core/info.h" + +namespace game +{ + +class Template : public core::Info { +public: + Template(); + + virtual ~Template(); + + /* --- inspectors ------------------------------------------------- */ + + inline const float radius() const { + return template_radius; + } + + inline const bool has_color() const { + return template_has_color; + } + + inline const math::Color & color() const { + return template_color; + } + + inline const bool has_color_second() const { + return template_has_color_second; + } + + inline const math::Color & color_second() const { + return template_color_second; + } + + /* --- actors ----------------------------------------------------- */ + + /** + * @brief apply a template to an entity + */ + void apply(core::Entity *entity) const; + +protected: + + /* --- mutators --------------------------------------------------- */ + + void set_radius(const float radius); + + void set_color(const math::Color &color); + + void set_color_second(const math::Color &color_second); + +public: + /* --- static ----------------------------------------------------- */ + + static bool init(); + + static void list(); + + static Template *find(const std::string & label); + +private: + + /* --- attributes ------------------------------------------------- */ + + float template_radius; + + math::Color template_color; + bool template_has_color; + + math::Color template_color_second; + bool template_has_color_second; + + /* --- static ----------------------------------------------------- */ + + static core::InfoType *template_infotype; +}; + +} // namespace game + +#endif // __INCLUDED_BASE_TEMPLATE_H__ |