zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Texture.hxx
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 #ifndef ZENI_TEXTURE_HXX
19 #define ZENI_TEXTURE_HXX
20 
21 // HXXed below
22 #include <Zeni/Textures.h>
23 
24 #include <Zeni/Texture.h>
25 
26 // Not HXXed
27 #ifndef DISABLE_GL
28 #if defined(REQUIRE_GL_ES)
29 #include <GLES/gl.h>
30 #else
31 #include <GL/glew.h>
32 #endif
33 #endif
34 
35 namespace Zeni {
36 
37  const Point2i & Sprite::get_size() const {
38  try {
39  return get_Textures()[m_frames[size_t(m_frame)].second].get_size();
40  }
41  catch(Database_Entry_Not_Found &) {
42  m_frames[size_t(m_frame)].second = get_Textures().get_id(m_frames[size_t(m_frame)].first);
43  return get_Textures()[m_frames[size_t(m_frame)].second].get_size();
44  }
45  }
46 
47 #ifndef DISABLE_GL
48  const Point2i & Texture_GL::get_size() const {
49  return m_size;
50  }
51 #endif
52 
53 #ifndef DISABLE_DX9
54  const Point2i & Texture_DX9::get_size() const {
55  return m_size;
56  }
57 
59  return m_render_to_surface;
60  }
61 #endif
62 
63 }
64 
65 #include <Zeni/Textures.hxx>
66 
67 #endif
Definition: Database.h:142
unsigned long get_id(const String &name) const
Get an id by name, possibly throwing an Error.
Definition: Database.hxx:172
GLint first
Definition: gl2ext.h:1011
interface ID3DXRenderToSurface ID3DXRenderToSurface
Definition: d3dx9core.h:471
const Point2i & get_size() const
Get the resolution of the current Texture on the GPU.
Definition: Texture.hxx:37
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
const Point2i & get_size() const
Get the resolution of the Texture on the GPU.
Definition: Texture.hxx:48
ID3DXRenderToSurface * render_to_surface() const
Definition: Texture.hxx:58
const Point2i & get_size() const
Get the resolution of the Texture on the GPU.
Definition: Texture.hxx:54
unsigned int size_t
A 2D Point represented with integers.
Definition: Coordinate.h:85