Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 7934a7f96e97cdf1477958092fc0d9812d429d1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
   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;
	
	/**
	 * @brief read template keys from an ini file
	 */
	static bool got_template_key(filesystem::IniFile &inifile, Template *entitytemplate);

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 done();
	
	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__