zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Colors.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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  * zenilib 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <zeni.h>
19 
20 #include <iomanip>
21 #include <iostream>
22 #include <fstream>
23 
24 #if defined(_DEBUG) && defined(_WINDOWS)
25 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
26 #define new DEBUG_NEW
27 #endif
28 
29 #include <Zeni/Database.hxx>
30 #include <Zeni/Singleton.hxx>
31 
32 namespace Zeni {
33 
34  template class Singleton<Colors>;
35  template class Database<Color>;
36 
37  Colors * Colors::create() {
38  return new Colors;
39  }
40 
41  Colors::Colors()
42  : Database<Color>("config/colors.xml", "Colors")
43  {
44  init();
45  }
46 
47  Colors::~Colors() {
49  }
50 
52  return Colors::get();
53  }
54 
55  Color * Colors::load(XML_Element_c &xml_element, const String &/*name*/, const String &/*filename*/) {
56  const float alpha = xml_element["alpha"].to_float();
57  const float red = xml_element["red"].to_float();
58  const float green = xml_element["green"].to_float();
59  const float blue = xml_element["blue"].to_float();
60 
61  return new Color(alpha, red, green, blue);
62  }
63 
64 }
Colors & get_Colors()
Get access to the singleton.
Definition: Colors.cpp:51
static void init(struct bs2b *bs2b)
Definition: bs2b.c:46
A Color database read in from a file.
Definition: Colors.h:50
GLclampf green
Definition: glew.h:1506
const GLubyte GLuint red
Definition: SDL_glfuncs.h:57
GLclampf GLclampf GLclampf alpha
Definition: glew.h:1506
GLclampf GLclampf blue
Definition: glew.h:1506