Crazy Eddie's GUI System  0.8.7
RendererModules/Null/Renderer.h
1 /***********************************************************************
2  created: Fri Jan 15 2010
3  author: Eugene Marcotte
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUINullRenderer_h_
28 #define _CEGUINullRenderer_h_
29 
30 #include "../../Renderer.h"
31 #include "../../Size.h"
32 #include "../../Vector.h"
33 
34 #include <vector>
35 #include <map>
36 
37 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
38 # ifdef CEGUINULLRENDERER_EXPORTS
39 # define NULL_GUIRENDERER_API __declspec(dllexport)
40 # else
41 # define NULL_GUIRENDERER_API __declspec(dllimport)
42 # endif
43 #else
44 # define NULL_GUIRENDERER_API
45 #endif
46 
47 #if defined(_MSC_VER)
48 # pragma warning(push)
49 # pragma warning(disable : 4251)
50 #endif
51 
52 
53 // Start of CEGUI namespace section
54 namespace CEGUI
55 {
56 class NullGeometryBuffer;
57 class NullTexture;
58 
60 class NULL_GUIRENDERER_API NullRenderer : public Renderer
61 {
62 public:
80  static NullRenderer& bootstrapSystem(const int abi = CEGUI_VERSION_ABI);
81 
97  static void destroySystem();
98 
103  static NullRenderer& create(const int abi = CEGUI_VERSION_ABI);
104 
106  static void destroy(NullRenderer& renderer);
107 
123  bool isTexCoordSystemFlipped() const { return false; }
124 
125  // implement CEGUI::Renderer interface
133  Texture& createTexture(const String& name);
135  const String& filename,
136  const String& resourceGroup);
137  Texture& createTexture(const String& name, const Sizef& size);
138  void destroyTexture(Texture& texture);
139  void destroyTexture(const String& name);
141  Texture& getTexture(const String& name) const;
142  bool isTextureDefined(const String& name) const;
144  void endRendering();
145  void setDisplaySize(const Sizef& sz);
146  const Sizef& getDisplaySize() const;
147  const Vector2f& getDisplayDPI() const;
148  uint getMaxTextureSize() const;
149  const String& getIdentifierString() const;
150 
151 protected:
157  virtual ~NullRenderer();
158 
160  void throwIfNameExists(const String& name) const;
162  static void logTextureCreation(const String& name);
164  static void logTextureDestruction(const String& name);
165 
175  typedef std::vector<TextureTarget*> TextureTargetList;
179  typedef std::vector<NullGeometryBuffer*> GeometryBufferList;
183  typedef std::map<String, NullTexture*, StringFastLessCompare
184  CEGUI_MAP_ALLOC(String, NullTexture*)> TextureMap;
189 };
190 
191 
192 } // End of CEGUI namespace section
193 
194 #if defined(_MSC_VER)
195 # pragma warning(pop)
196 #endif
197 
198 #endif // end of guard _CEGUINullRenderer_h_
CEGUI::GeometryBuffer
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:44
CEGUI::NullTexture
Implementation of the CEGUI::Texture class for no particular engine.
Definition: RendererModules/Null/Texture.h:43
CEGUI::NullRenderer::destroy
static void destroy(NullRenderer &renderer)
destory an NullRenderer object.
CEGUI::NullRenderer::createGeometryBuffer
GeometryBuffer & createGeometryBuffer()
Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from a...
CEGUI::NullRenderer::d_defaultTarget
RenderTarget * d_defaultTarget
The default RenderTarget.
Definition: RendererModules/Null/Renderer.h:173
CEGUI::StringFastLessCompare
Functor that can be used as comparator in a std::map with String keys. It's faster than using the def...
Definition: String.h:5580
CEGUI::NullRenderer::destroyAllTextureTargets
void destroyAllTextureTargets()
Destory all TextureTarget objects created by this Renderer.
CEGUI::NullRenderer::createTexture
Texture & createTexture(const String &name)
Create a 'null' Texture object.
CEGUI::NullRenderer::createTexture
Texture & createTexture(const String &name, const Sizef &size)
Create a Texture object with the given pixel dimensions as specified by size.
CEGUI::NullRenderer::logTextureDestruction
static void logTextureDestruction(const String &name)
helper to safely log the destruction of a named texture
CEGUI::NullRenderer::getDisplayDPI
const Vector2f & getDisplayDPI() const
Return the resolution of the display or host window in dots per inch.
CEGUI::NullRenderer
CEGUI::Renderer implementation for no particular engine.
Definition: RendererModules/Null/Renderer.h:61
CEGUI::NullRenderer::logTextureCreation
static void logTextureCreation(const String &name)
helper to safely log the creation of a named texture
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::NullRenderer::constructor_impl
void constructor_impl()
common construction things.
CEGUI::NullRenderer::isTextureDefined
bool isTextureDefined(const String &name) const
Return whether a texture with the given name exists.
CEGUI::NullRenderer::beginRendering
void beginRendering()
Perform any operations required to put the system into a state ready for rendering operations to begi...
CEGUI::Vector2< float >
CEGUI::NullRenderer::getMaxTextureSize
uint getMaxTextureSize() const
Return the pixel size of the maximum supported texture.
CEGUI::NullRenderer::bootstrapSystem
static NullRenderer & bootstrapSystem(const int abi=CEGUI_VERSION_ABI)
Convenience function that creates all the necessary objects then initialises the CEGUI system with th...
CEGUI::NullRenderer::throwIfNameExists
void throwIfNameExists(const String &name) const
helper to throw exception if name is already used.
CEGUI::NullRenderer::create
static NullRenderer & create(const int abi=CEGUI_VERSION_ABI)
Create an NullRenderer object.
CEGUI::NullRenderer::d_displayDPI
Vector2f d_displayDPI
What the renderer considers to be the current display DPI resolution.
Definition: RendererModules/Null/Renderer.h:171
CEGUI::NullRenderer::getDisplaySize
const Sizef & getDisplaySize() const
Return the size of the display or host window in pixels.
CEGUI::NullRenderer::d_geometryBuffers
GeometryBufferList d_geometryBuffers
Container used to track geometry buffers.
Definition: RendererModules/Null/Renderer.h:181
CEGUI::NullRenderer::isTexCoordSystemFlipped
bool isTexCoordSystemFlipped() const
Returns if the texture coordinate system is vertically flipped or not. The original of a texture coor...
Definition: RendererModules/Null/Renderer.h:123
CEGUI::NullRenderer::TextureMap
std::map< String, NullTexture *, StringFastLessCompare CEGUI_MAP_ALLOC(String, NullTexture *)> TextureMap
container type used to hold Textures we create.
Definition: RendererModules/Null/Renderer.h:184
CEGUI::NullRenderer::GeometryBufferList
std::vector< NullGeometryBuffer * > GeometryBufferList
container type used to hold GeometryBuffers we create.
Definition: RendererModules/Null/Renderer.h:179
CEGUI::Texture
Abstract base class specifying the required interface for Texture objects.
Definition: Texture.h:54
CEGUI::NullRenderer::getDefaultRenderTarget
RenderTarget & getDefaultRenderTarget()
Returns the default RenderTarget object. The default render target is is typically one that targets t...
CEGUI::NullRenderer::TextureTargetList
std::vector< TextureTarget * > TextureTargetList
container type used to hold TextureTargets we create.
Definition: RendererModules/Null/Renderer.h:175
CEGUI::NullRenderer::destroySystem
static void destroySystem()
Convenience function to cleanup the CEGUI system and related objects that were created by calling the...
CEGUI::NullRenderer::~NullRenderer
virtual ~NullRenderer()
destructor.
CEGUI::NullRenderer::destroyGeometryBuffer
void destroyGeometryBuffer(const GeometryBuffer &buffer)
Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function....
CEGUI::NullRenderer::d_textureTargets
TextureTargetList d_textureTargets
Container used to track texture targets.
Definition: RendererModules/Null/Renderer.h:177
CEGUI::NullRenderer::createTexture
Texture & createTexture(const String &name, const String &filename, const String &resourceGroup)
Create a Texture object using the given image file.
CEGUI::NullRenderer::d_maxTextureSize
uint d_maxTextureSize
What the renderer thinks the max texture size is.
Definition: RendererModules/Null/Renderer.h:188
CEGUI::NullRenderer::destroyAllGeometryBuffers
void destroyAllGeometryBuffers()
Destroy all GeometryBuffer objects created by this Renderer.
CEGUI::NullRenderer::endRendering
void endRendering()
Perform any operations required to finalise rendering.
CEGUI::NullRenderer::destroyAllTextures
void destroyAllTextures()
Destroy all Texture objects created by this Renderer.
CEGUI::NullRenderer::destroyTexture
void destroyTexture(Texture &texture)
Destroy a Texture object that was previously created by calling the createTexture functions.
CEGUI::NullRenderer::getIdentifierString
const String & getIdentifierString() const
Return identification string for the renderer module.
CEGUI::RenderTarget
Defines interface to some surface that can be rendered to. Concrete instances of objects that impleme...
Definition: RenderTarget.h:60
CEGUI::NullRenderer::createTextureTarget
TextureTarget * createTextureTarget()
Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose i...
CEGUI::Size< float >
CEGUI::NullRenderer::destroyTexture
void destroyTexture(const String &name)
Destroy a Texture object that was previously created by calling the createTexture functions.
CEGUI::TextureTarget
Specialisation of RenderTarget interface that should be used as the base class for RenderTargets that...
Definition: TextureTarget.h:41
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::NullRenderer::d_rendererID
static String d_rendererID
String holding the renderer identification text.
Definition: RendererModules/Null/Renderer.h:167
CEGUI::NullRenderer::d_textures
TextureMap d_textures
Container used to track textures.
Definition: RendererModules/Null/Renderer.h:186
CEGUI::NullRenderer::getTexture
Texture & getTexture(const String &name) const
Return a Texture object that was previously created by calling the createTexture functions.
CEGUI::NullRenderer::setDisplaySize
void setDisplaySize(const Sizef &sz)
Set the size of the display or host window in pixels for this Renderer object.
CEGUI::NullRenderer::NullRenderer
NullRenderer()
default constructor.
CEGUI::Renderer
Abstract class defining the basic required interface for Renderer objects.
Definition: Renderer.h:84
CEGUI::NullRenderer::destroyTextureTarget
void destroyTextureTarget(TextureTarget *target)
Function that cleans up TextureTarget objects created with the createTextureTarget function.
CEGUI::NullRenderer::d_displaySize
Sizef d_displaySize
What the renderer considers to be the current display size.
Definition: RendererModules/Null/Renderer.h:169