Crazy Eddie's GUI System  0.8.7
RendererModules/DirectFB/Renderer.h
1 /***********************************************************************
2  created: Tue Mar 10 2009
3  author: Paul D Turner (parts based on code by Keith Mok)
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 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 _CEGUIDirectFBRenderer_h_
28 #define _CEGUIDirectFBRenderer_h_
29 
30 #include "CEGUI/Renderer.h"
31 #include "CEGUI/Size.h"
32 #include "CEGUI/Vector.h"
33 #include <directfb.h>
34 #include <vector>
35 #include <map>
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
40 class DirectFBTexture;
41 class DirectFBGeometryBuffer;
42 
44 class DirectFBRenderer : public Renderer
45 {
46 public:
48  static DirectFBRenderer& create(IDirectFB& directfb,
49  IDirectFBSurface& surface,
50  const int abi = CEGUI_VERSION_ABI);
52  static void destroy(DirectFBRenderer& renderer);
53 
55  IDirectFBSurface& getTargetSurface() const;
56 
58  void setTargetSurface(IDirectFBSurface& surface);
59 
75  bool isTexCoordSystemFlipped() const { return false; }
76 
77  // Implementation of Renderer interface.
78  RenderTarget& getDefaultRenderTarget();
79  GeometryBuffer& createGeometryBuffer();
80  void destroyGeometryBuffer(const GeometryBuffer& buffer);
82  TextureTarget* createTextureTarget();
83  void destroyTextureTarget(TextureTarget* target);
85  Texture& createTexture(const CEGUI::String& name);
86  Texture& createTexture(const CEGUI::String& name,
87  const String& filename,
88  const String& resourceGroup);
89  Texture& createTexture(const CEGUI::String& name, const Sizef& size);
90  void destroyTexture(Texture& texture);
91  void destroyTexture(const CEGUI::String& name);
92  void destroyAllTextures();
93  Texture& getTexture(const String&) const;
94  bool isTextureDefined(const String& name) const;
96  void endRendering();
97  void setDisplaySize(const Sizef& sz);
98  const Sizef& getDisplaySize() const;
99  const Vector2f& getDisplayDPI() const;
100  uint getMaxTextureSize() const;
101  const String& getIdentifierString() const;
102 
103 protected:
105  DirectFBRenderer(IDirectFB& directfb, IDirectFBSurface& surface);
108 
110  static void logTextureCreation(DirectFBTexture* texture);
112  static void logTextureDestruction(DirectFBTexture* texture);
113 
115  static String d_rendererID;
117  IDirectFB& d_directfb;
119  IDirectFBSurface& d_rootSurface;
121  IDirectFBSurface* d_targetSurface;
129  typedef std::vector<TextureTarget*> TextureTargetList;
133  typedef std::vector<DirectFBGeometryBuffer*> GeometryBufferList;
137  typedef std::map<String, DirectFBTexture*, StringFastLessCompare> TextureMap;
140 };
141 
142 } // End of CEGUI namespace section
143 
144 #endif // end of guard _CEGUIDirectFBRenderer_h_
CEGUI::DirectFBRenderer::TextureMap
std::map< String, DirectFBTexture *, StringFastLessCompare > TextureMap
container type used to hold Textures we create.
Definition: RendererModules/DirectFB/Renderer.h:157
CEGUI::DirectFBRenderer::setDisplaySize
void setDisplaySize(const Sizef &sz)
Set the size of the display or host window in pixels for this Renderer object.
CEGUI::DirectFBRenderer::d_defaultTarget
RenderTarget * d_defaultTarget
The default RenderTarget.
Definition: RendererModules/DirectFB/Renderer.h:147
CEGUI::DirectFBRenderer::createTexture
Texture & createTexture(const CEGUI::String &name)
Create a 'null' Texture object.
CEGUI::DirectFBRenderer::d_textureTargets
TextureTargetList d_textureTargets
Container used to track texture targets.
Definition: RendererModules/DirectFB/Renderer.h:151
CEGUI::DirectFBRenderer::logTextureCreation
static void logTextureCreation(DirectFBTexture *texture)
helper to safely log the creation of a named texture
CEGUI::DirectFBRenderer::getDefaultRenderTarget
RenderTarget & getDefaultRenderTarget()
Returns the default RenderTarget object. The default render target is is typically one that targets t...
CEGUI::DirectFBRenderer::DirectFBRenderer
DirectFBRenderer(IDirectFB &directfb, IDirectFBSurface &surface)
Constructor.
CEGUI::DirectFBRenderer::d_rendererID
static String d_rendererID
String holding the renderer identification text.
Definition: RendererModules/DirectFB/Renderer.h:135
CEGUI::DirectFBTexture
Implementation of CEGUI::Texture interface using DirectFB.
Definition: RendererModules/DirectFB/Texture.h:58
CEGUI::DirectFBRenderer::destroyAllTextures
void destroyAllTextures()
Destroy all Texture objects created by this Renderer.
CEGUI::DirectFBRenderer::destroyAllGeometryBuffers
void destroyAllGeometryBuffers()
Destroy all GeometryBuffer objects created by this Renderer.
CEGUI::DirectFBRenderer::setTargetSurface
void setTargetSurface(IDirectFBSurface &surface)
Set the target DirectFB surface.
CEGUI::DirectFBRenderer::d_directfb
IDirectFB & d_directfb
DirectFB interface we were given when constructed.
Definition: RendererModules/DirectFB/Renderer.h:137
CEGUI::DirectFBRenderer::isTextureDefined
bool isTextureDefined(const String &name) const
Return whether a texture with the given name exists.
CEGUI::DirectFBRenderer::destroyAllTextureTargets
void destroyAllTextureTargets()
Destory all TextureTarget objects created by this Renderer.
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::Vector2< float >
CEGUI::DirectFBRenderer::d_targetSurface
IDirectFBSurface * d_targetSurface
The current target DirectFB surface.
Definition: RendererModules/DirectFB/Renderer.h:141
CEGUI::DirectFBRenderer::getIdentifierString
const String & getIdentifierString() const
Return identification string for the renderer module.
CEGUI::DirectFBRenderer::getMaxTextureSize
uint getMaxTextureSize() const
Return the pixel size of the maximum supported texture.
CEGUI::DirectFBRenderer::createGeometryBuffer
GeometryBuffer & createGeometryBuffer()
Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from a...
CEGUI::DirectFBRenderer::getDisplaySize
const Sizef & getDisplaySize() const
Return the size of the display or host window in pixels.
CEGUI::DirectFBRenderer::d_displayDPI
Vector2f d_displayDPI
What the renderer considers to be the current display DPI resolution.
Definition: RendererModules/DirectFB/Renderer.h:145
CEGUI::DirectFBRenderer::createTextureTarget
TextureTarget * createTextureTarget()
Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose i...
CEGUI::DirectFBRenderer::~DirectFBRenderer
~DirectFBRenderer()
Destructor.
CEGUI::DirectFBRenderer::d_textures
TextureMap d_textures
Container used to track textures.
Definition: RendererModules/DirectFB/Renderer.h:159
CEGUI::DirectFBRenderer::logTextureDestruction
static void logTextureDestruction(DirectFBTexture *texture)
helper to safely log the destruction of a named texture
CEGUI::DirectFBRenderer::d_geometryBuffers
GeometryBufferList d_geometryBuffers
Container used to track geometry buffers.
Definition: RendererModules/DirectFB/Renderer.h:155
CEGUI::DirectFBRenderer::endRendering
void endRendering()
Perform any operations required to finalise rendering.
CEGUI::DirectFBRenderer::destroyGeometryBuffer
void destroyGeometryBuffer(const GeometryBuffer &buffer)
Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function....
CEGUI::DirectFBRenderer::GeometryBufferList
std::vector< DirectFBGeometryBuffer * > GeometryBufferList
container type used to hold GeometryBuffers we create.
Definition: RendererModules/DirectFB/Renderer.h:153
CEGUI::RenderTarget
Defines interface to some surface that can be rendered to. Concrete instances of objects that impleme...
Definition: RenderTarget.h:77
CEGUI::DirectFBRenderer::destroyTextureTarget
void destroyTextureTarget(TextureTarget *target)
Function that cleans up TextureTarget objects created with the createTextureTarget function.
CEGUI::Size< float >
CEGUI::DirectFBRenderer::d_displaySize
Sizef d_displaySize
What the renderer considers to be the current display size.
Definition: RendererModules/DirectFB/Renderer.h:143
CEGUI::DirectFBRenderer::isTexCoordSystemFlipped
bool isTexCoordSystemFlipped() const
Returns if the texture coordinate system is vertically flipped or not. The original of a texture coor...
Definition: RendererModules/DirectFB/Renderer.h:95
CEGUI::String
String class used within the GUI system.
Definition: String.h:83
CEGUI::DirectFBRenderer::destroyTexture
void destroyTexture(Texture &texture)
Destroy a Texture object that was previously created by calling the createTexture functions.
CEGUI::DirectFBRenderer::beginRendering
void beginRendering()
Perform any operations required to put the system into a state ready for rendering operations to begi...
CEGUI::DirectFBRenderer::destroy
static void destroy(DirectFBRenderer &renderer)
destroy a DirectFBRenderer object created by the create call.
CEGUI::DirectFBRenderer::TextureTargetList
std::vector< TextureTarget * > TextureTargetList
container type used to hold TextureTargets we create.
Definition: RendererModules/DirectFB/Renderer.h:149
CEGUI::DirectFBRenderer::getTargetSurface
IDirectFBSurface & getTargetSurface() const
Return the current target DirectFB surface.
CEGUI::DirectFBRenderer::getDisplayDPI
const Vector2f & getDisplayDPI() const
Return the resolution of the display or host window in dots per inch.
CEGUI::DirectFBRenderer::create
static DirectFBRenderer & create(IDirectFB &directfb, IDirectFBSurface &surface, const int abi=CEGUI_VERSION_ABI)
create a DirectFBRenderer object.
CEGUI::DirectFBRenderer::getTexture
Texture & getTexture(const String &) const
Return a Texture object that was previously created by calling the createTexture functions.
CEGUI::DirectFBRenderer::d_rootSurface
IDirectFBSurface & d_rootSurface
The DirectFB surface to be used as the default root target.
Definition: RendererModules/DirectFB/Renderer.h:139