Crazy Eddies GUI System  0.6.2
Classes | Public Member Functions | List of all members
CEGUI::DirectX9Renderer Class Reference

Renderer class to interface with Microsoft DirectX 9.0. More...

+ Inheritance diagram for CEGUI::DirectX9Renderer:
+ Collaboration diagram for CEGUI::DirectX9Renderer:

Public Member Functions

 DirectX9Renderer (LPDIRECT3DDEVICE9 device, uint max_quads)
 Constructor for Direct3D 9.0 Renderer object. More...
 
virtual ~DirectX9Renderer (void)
 Destructor for DirectX9Renderer objects.
 
virtual void addQuad (const Rect &dest_rect, float z, const Texture *tex, const Rect &texture_rect, const ColourRect &colours, QuadSplitMode quad_split_mode)
 Add a quad to the rendering queue. All clipping and other adjustments should have been made prior to calling this. More...
 
virtual void doRender (void)
 Perform final rendering for all quads that have been queued for rendering. More...
 
virtual void clearRenderList (void)
 Clears all queued quads from the render queue. More...
 
virtual void setQueueingEnabled (bool setting)
 Enable or disable the queueing of quads from this point on. More...
 
virtual TexturecreateTexture (void)
 Creates a 'null' Texture object. More...
 
virtual TexturecreateTexture (const String &filename, const String &resourceGroup)
 Create a Texture object using the given image file. More...
 
virtual TexturecreateTexture (float size)
 Create a Texture object with the given pixel dimensions as specified by size. NB: Textures are always square. More...
 
virtual void destroyTexture (Texture *texture)
 Destroy the given Texture object. More...
 
virtual void destroyAllTextures (void)
 Destroy all Texture objects. More...
 
LPDIRECT3DDEVICE9 getDevice (void) const
 
virtual bool isQueueingEnabled (void) const
 Return whether queueing is enabled. More...
 
virtual float getWidth (void) const
 Return the current width of the display in pixels. More...
 
virtual float getHeight (void) const
 Return the current height of the display in pixels. More...
 
virtual Size getSize (void) const
 Return the size of the display in pixels. More...
 
virtual Rect getRect (void) const
 Return a Rect describing the screen. More...
 
virtual uint getMaxTextureSize (void) const
 Return the maximum texture size available. More...
 
virtual uint getHorzScreenDPI (void) const
 Return the horizontal display resolution dpi. More...
 
virtual uint getVertScreenDPI (void) const
 Return the vertical display resolution dpi. More...
 
virtual void preD3DReset (void)
 Direct3D support method that must be called prior to a Reset call on the Direct3DDevice; this is required so that the GUI renderer can release any unmanaged D3D resources as needed for the device reset to succeed.
 
virtual void postD3DReset (void)
 Direct3D support method that must be called after a Reset call on the Direct3DDevice; this is required so that the GUI renderer can rebuild any unmanaged D3D resources after the device has been reset.
 
void setDisplaySize (const Size &sz)
 Set the size of the display in pixels. More...
 
- Public Member Functions inherited from CEGUI::Renderer
void resetZValue (void)
 Reset the z co-ordinate for rendering. More...
 
void advanceZValue (void)
 Update the z co-ordinate for the next major UI element (window). More...
 
float getCurrentZ (void) const
 return the current Z value to use (equates to layer 0 for this UI element). More...
 
float getZLayer (uint layer) const
 return the z co-ordinate to use for the requested layer on the current GUI element. More...
 
const StringgetIdentifierString () const
 Return identification string for the renderer module. If the internal id string has not been set by the Renderer module creator, a generic string of "Unknown renderer" will be returned. More...
 
virtual ResourceProvidercreateResourceProvider (void)
 
- Public Member Functions inherited from CEGUI::EventSet
 EventSet ()
 Constructor for EventSet objects.
 
virtual ~EventSet (void)
 Destructor for EventSet objects.
 
void addEvent (const String &name)
 Add a new Event to the EventSet with the given name. More...
 
void removeEvent (const String &name)
 Removes the Event with the given name. All connections to the event are disconnected. More...
 
void removeAllEvents (void)
 Remove all Event objects from the EventSet. More...
 
bool isEventPresent (const String &name)
 Checks to see if an Event with the given name is present in the EventSet. More...
 
virtual Event::Connection subscribeEvent (const String &name, Event::Subscriber subscriber)
 Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
virtual Event::Connection subscribeEvent (const String &name, Event::Group group, Event::Subscriber subscriber)
 Subscribes a handler to the specified group of the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
virtual Event::Connection subscribeScriptedEvent (const String &name, const String &subscriber_name)
 Subscribes the named Event to a scripted funtion. More...
 
virtual Event::Connection subscribeScriptedEvent (const String &name, Event::Group group, const String &subscriber_name)
 Subscribes the specified group of the named Event to a scripted funtion. More...
 
virtual void fireEvent (const String &name, EventArgs &args, const String &eventNamespace="")
 Fires the named event passing the given EventArgs object. More...
 
bool isMuted (void) const
 Return whether the EventSet is muted or not. More...
 
void setMutedState (bool setting)
 Set the mute state for this EventSet. More...
 
Iterator getIterator (void) const
 Return a EventSet::Iterator object to iterate over the events currently added to the EventSet.
 

Additional Inherited Members

- Public Types inherited from CEGUI::EventSet
typedef ConstBaseIterator
< EventMap > 
Iterator
 
- Static Public Attributes inherited from CEGUI::Renderer
static const String EventNamespace
 Namespace for global events.
 
static const String EventDisplaySizeChanged
 
- Protected Types inherited from CEGUI::EventSet
typedef std::map< String,
Event
*, String::FastLessCompare
EventMap
 
- Protected Member Functions inherited from CEGUI::EventSet
EventgetEventObject (const String &name, bool autoAdd=false)
 Return a pointer to the Event object with the given name, optionally adding such an Event object to the EventSet if it does not already exist. More...
 
void fireEvent_impl (const String &name, EventArgs &args)
 Implementation event firing member.
 
 EventSet (EventSet &e)
 
EventSetoperator= (EventSet &e)
 
- Protected Attributes inherited from CEGUI::Renderer
ResourceProviderd_resourceProvider
 Holds the pointer to the ResourceProvider object.
 
String d_identifierString
 String that holds some id information about the renderer.
 

Detailed Description

Renderer class to interface with Microsoft DirectX 9.0.

Constructor & Destructor Documentation

CEGUI::DirectX9Renderer::DirectX9Renderer ( LPDIRECT3DDEVICE9  device,
uint  max_quads 
)

Constructor for Direct3D 9.0 Renderer object.

Parameters
devicePointer to the IDirect3DDevice9 interface object that will be used for all rendering
max_quadsObsolete. Set to 0.

Member Function Documentation

void CEGUI::DirectX9Renderer::addQuad ( const Rect dest_rect,
float  z,
const Texture tex,
const Rect texture_rect,
const ColourRect colours,
QuadSplitMode  quad_split_mode 
)
virtual

Add a quad to the rendering queue. All clipping and other adjustments should have been made prior to calling this.

Parameters
dest_rectRect object describing the destination area (values are in pixels)
zfloat value specifying the z co-ordinate / z order of the quad
texpointer to the Texture object that holds the imagery to be rendered
texture_rectRect object holding the area of tex that is to be rendered (values are in texture co-ordinates).
coloursColourRect object describing the colour values that are to be applied when rendering.
quad_split_modeOne of the QuadSplitMode values specifying the way quads are split into triangles
Returns
Nothing

Implements CEGUI::Renderer.

void CEGUI::DirectX9Renderer::clearRenderList ( void  )
virtual

Clears all queued quads from the render queue.

Returns
Nothing

Implements CEGUI::Renderer.

Texture * CEGUI::DirectX9Renderer::createTexture ( void  )
virtual

Creates a 'null' Texture object.

Returns
a newly created Texture object. The returned Texture object has no size or imagery associated with it, and is generally of little or no use.

Implements CEGUI::Renderer.

Texture * CEGUI::DirectX9Renderer::createTexture ( const String filename,
const String resourceGroup 
)
virtual

Create a Texture object using the given image file.

Parameters
filenameString object that specifies the path and filename of the image file to use when creating the texture.
resourceGroupResource group identifier to be passed to the resource provider when loading the texture file.
Returns
a newly created Texture object. The initial contents of the texture memory is the requested image file.
Note
Textures are always created with a size that is a power of 2. If the file you specify is of a size that is not a power of two, the final size will be rounded up. Additionally, textures are always square, so the ultimate size is governed by the larger of the width and height of the specified file. You can check the ultimate sizes by querying the texture after creation.

Implements CEGUI::Renderer.

References CEGUI::DirectX9Texture::loadFromFile().

Texture * CEGUI::DirectX9Renderer::createTexture ( float  size)
virtual

Create a Texture object with the given pixel dimensions as specified by size. NB: Textures are always square.

Parameters
sizefloat value that specifies the size to use for the width and height when creating the new texture.
Returns
a newly created Texture object. The initial contents of the texture memory is undefined / random.
Note
Textures are always created with a size that is a power of 2. If you specify a size that is not a power of two, the final size will be rounded up. So if you specify a size of 1024, the texture will be (1024 x 1024), however, if you specify a size of 1025, the texture will be (2048 x 2048). You can check the ultimate size by querying the texture after creation.

Implements CEGUI::Renderer.

References CEGUI::DirectX9Texture::setD3DTextureSize().

void CEGUI::DirectX9Renderer::destroyAllTextures ( void  )
virtual

Destroy all Texture objects.

Returns
Nothing

Implements CEGUI::Renderer.

References destroyTexture().

Referenced by ~DirectX9Renderer().

void CEGUI::DirectX9Renderer::destroyTexture ( Texture texture)
virtual

Destroy the given Texture object.

Parameters
texturepointer to the Texture object to be destroyed
Returns
Nothing

Implements CEGUI::Renderer.

Referenced by destroyAllTextures().

void CEGUI::DirectX9Renderer::doRender ( void  )
virtual

Perform final rendering for all quads that have been queued for rendering.

    The contents of the rendering queue is retained and can be rendered again as required.  If the contents is not required call clearRenderList().
Returns
Nothing

Implements CEGUI::Renderer.

References CEGUI::TopLeftToBottomRight.

virtual float CEGUI::DirectX9Renderer::getHeight ( void  ) const
inlinevirtual

Return the current height of the display in pixels.

Returns
float value equal to the current height of the display in pixels.

Implements CEGUI::Renderer.

virtual uint CEGUI::DirectX9Renderer::getHorzScreenDPI ( void  ) const
inlinevirtual

Return the horizontal display resolution dpi.

Returns
horizontal resolution of the display in dpi.

Implements CEGUI::Renderer.

virtual uint CEGUI::DirectX9Renderer::getMaxTextureSize ( void  ) const
inlinevirtual

Return the maximum texture size available.

Returns
Size of the maximum supported texture in pixels (textures are always assumed to be square)

Implements CEGUI::Renderer.

virtual Rect CEGUI::DirectX9Renderer::getRect ( void  ) const
inlinevirtual

Return a Rect describing the screen.

Returns
A Rect object that describes the screen area. Typically, the top-left values are always 0, and the size of the area described is equal to the screen resolution.

Implements CEGUI::Renderer.

virtual Size CEGUI::DirectX9Renderer::getSize ( void  ) const
inlinevirtual

Return the size of the display in pixels.

Returns
Size object describing the dimensions of the current display.

Implements CEGUI::Renderer.

virtual uint CEGUI::DirectX9Renderer::getVertScreenDPI ( void  ) const
inlinevirtual

Return the vertical display resolution dpi.

Returns
vertical resolution of the display in dpi.

Implements CEGUI::Renderer.

virtual float CEGUI::DirectX9Renderer::getWidth ( void  ) const
inlinevirtual

Return the current width of the display in pixels.

Returns
float value equal to the current width of the display in pixels.

Implements CEGUI::Renderer.

virtual bool CEGUI::DirectX9Renderer::isQueueingEnabled ( void  ) const
inlinevirtual

Return whether queueing is enabled.

Returns
true if queueing is enabled, false if queueing is disabled.

Implements CEGUI::Renderer.

void CEGUI::DirectX9Renderer::setDisplaySize ( const Size sz)

Set the size of the display in pixels.

    You do not have to call this method under normal operation as the system
    will automatically extract the size from the current view port.
Note
This method will cause the EventDisplaySizeChanged event to fire if the display size has changed.
Parameters
szSize object describing the size of the display.
Returns
Nothing.

References CEGUI::Renderer::EventDisplaySizeChanged, CEGUI::Renderer::EventNamespace, CEGUI::EventSet::fireEvent(), CEGUI::Rect::getSize(), and CEGUI::Rect::setSize().

Referenced by postD3DReset().

virtual void CEGUI::DirectX9Renderer::setQueueingEnabled ( bool  setting)
inlinevirtual

Enable or disable the queueing of quads from this point on.

    This only affects queueing.  If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly.  Note that
    disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still
    be drawn by calling doRender, and the list can be cleared by calling clearRenderList.  Re-enabling the queue causes subsequent quads
    to be added as if queueing had never been disabled.
Parameters
settingtrue to enable queueing, or false to disable queueing (see notes above).
Returns
Nothing

Implements CEGUI::Renderer.