zenilib: zenilib/jni/external/zenilib/zeni_graphics/Zeni/Textures.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Textures.h
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
32 #ifndef ZENI_TEXTURES_H
33 #define ZENI_TEXTURES_H
34
35 #include <Zeni/Core.h>
36 #include <Zeni/Database.h>
37
38 #ifdef _WINDOWS
39 #include <Windows.h>
40 #endif
41
42 namespace Zeni {
43
44 class Texture;
45 class Textures;
46
47 #ifdef _WINDOWS
48 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Singleton<Textures>;
49 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Database<Texture>;
50 #endif
51
52 class ZENI_GRAPHICS_DLL Textures : public Singleton<Textures>, public Database<Texture> {
53 friend class Singleton<Textures>;
54
55 static Textures * create();
56
57 #ifdef _WINDOWS
58 #pragma warning( push )
59 #pragma warning( disable : 4251 )
60 #endif
61 static class Lose : public Event::Handler {
62 void operator()() {
63 get().lose_resources();
64 }
65
66 Lose * duplicate() const {
67 return new Lose;
68 }
69
70 public:
71 Lose() {}
72
73 // Undefined
74 Lose(const Lose &);
75 Lose operator=(const Lose &);
76 } g_lose;
77
78 static class Unlose : public Event::Handler {
79 void operator()() {
80 get().unlose_resources();
81 }
82
83 Unlose * duplicate() const {
84 return new Unlose;
85 }
86
87 public:
88 Unlose() {}
89
90 // Undefined
91 Unlose(const Unlose &);
92 Unlose operator=(const Unlose &);
93 } g_unlose;
94 #ifdef _WINDOWS
95 #pragma warning( pop )
96 #endif
97
98 Textures();
99 ~Textures();
100
101 // Undefined
102 Textures(const Textures &);
103 Textures & operator=(const Textures &);
104
105 public:
106 // Accessors
107 inline static bool get_bilinear_filtering();
108 inline static bool get_mipmapping();
109 inline static bool get_trilinear_filtering();
110 inline static int get_anisotropic_filtering();
111 inline static bool get_lazy_loading();
112
113 // Loading Options
114 static void set_texturing_mode(const int &anisotropic_filtering_,
115 const bool &bilinear_filtering_,
116 const bool &mipmapping_);
117 inline static void set_lazy_loading(const bool &lazy_loading = true);
118
119 // Appliers
120 void apply_Texture(const String &name);
121 void apply_Texture(const unsigned long &id);
122
123 // Sprite-specific
124 bool is_Sprite(const unsigned long &id);
125 int get_num_frames(const unsigned long &id);
126 int get_current_frame(const unsigned long &id);
127 void set_current_frame(const unsigned long &id, const int &frame_number);
128
129 private:
130 virtual void on_load();
131 virtual void on_clear();
132 virtual void on_lose();
133
134 virtual Texture * load(XML_Element_c &xml_element, const String &name, const String &filename);
135
136 static bool m_loaded;
137 static bool m_bilinear_filtering;
138 static bool m_mipmapping;
139 static int m_anisotropic_filtering;
140 static bool m_lazy_loading;
141 };
142
143 ZENI_GRAPHICS_DLL Textures & get_Textures();
144
145 struct ZENI_GRAPHICS_DLL Sprite_Function_Misapplied : public Error {
146 Sprite_Function_Misapplied() : Error("Sprite Function Misapplied") {}
147 };
148
149 }
150
151 #endif
Zeni::Sprite_Function_Misapplied::Sprite_Function_Misapplied
Sprite_Function_Misapplied()
Definition: Textures.h:146
Zeni::Singleton< Textures >
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
Zeni::Database< Texture >
Zeni::Sprite_Function_Misapplied
Definition: Textures.h:145
sort_controllers.filename
string filename
Definition: sort_controllers.py:8
Zeni::Textures
A Texture Database Singleton.
Definition: Textures.h:52
Database.h
Zeni::get_Textures
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
Zeni::Event::Handler
Definition: Event.h:27
Zeni::Error
The Error Class.
Definition: Error.h:52
Core.h