]> git.tdb.fi Git - poefilter.git/blob - source/theme.cpp
Initial version from when I last played
[poefilter.git] / source / theme.cpp
1 #include <msp/core/maputils.h>
2 #include "theme.h"
3
4 using namespace std;
5 using namespace Msp;
6
7 Color::Color():
8         r(200),
9         g(200),
10         b(200)
11 { }
12
13 Color::Color(unsigned r_, unsigned g_, unsigned b_):
14         r(r_),
15         g(g_),
16         b(b_)
17 { }
18
19
20 Theme::Theme():
21         base_font_size(32)
22 { }
23
24 void Theme::set_color(const string &name, const Color &color)
25 {
26         colors[name] = color;
27 }
28
29 const Color &Theme::get_color(const string &name) const
30 {
31         return get_item(colors, name);
32 }
33
34 void Theme::set_base_font_size(unsigned size)
35 {
36         base_font_size = size;
37 }
38
39
40 Theme::Loader::Loader(Theme &t):
41         DataFile::ObjectLoader<Theme>(t)
42 {
43         add("base_font_size", &Theme::base_font_size);
44         add("color", &Loader::color);
45 }
46
47 void Theme::Loader::color(const string &name, unsigned r, unsigned g, unsigned b)
48 {
49         obj.set_color(name, Color(r, g, b));
50 }