# CEGUI::DirectX9Renderer Class Reference

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

Inheritance diagram for CEGUI::DirectX9Renderer:

[legend]
Collaboration diagram for CEGUI::DirectX9Renderer:

[legend]
List of all members.

## Public Member Functions

| DirectX9Renderer (LPDIRECT3DDEVICE9 device, uint max_quads)
| Constructor for Direct3D 9.0 Renderer object.
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.
virtual void | doRender (void)
| Perform final rendering for all quads that have been queued for rendering.
virtual void | clearRenderList (void)
| Clears all queued quads from the render queue.
virtual void | setQueueingEnabled (bool setting)
| Enable or disable the queueing of quads from this point on.
virtual Texture * | createTexture (void)
| Creates a 'null' Texture object.
virtual Texture * | createTexture (const String &filename, const String &resourceGroup)
| Create a Texture object using the given image file.
virtual Texture * | createTexture (float size)
| Create a Texture object with the given pixel dimensions as specified by size. NB: Textures are always square.
virtual void | destroyTexture (Texture *texture)
| Destroy the given Texture object.
virtual void | destroyAllTextures (void)
| Destroy all Texture objects.
LPDIRECT3DDEVICE9 | getDevice (void) const
virtual bool | isQueueingEnabled (void) const
| Return whether queueing is enabled.
virtual float | getWidth (void) const
| Return the current width of the display in pixels.
virtual float | getHeight (void) const
| Return the current height of the display in pixels.
virtual Size | getSize (void) const
| Return the size of the display in pixels.
virtual Rect | getRect (void) const
| Return a Rect describing the screen.
virtual uint | getMaxTextureSize (void) const
| Return the maximum texture size available.
virtual uint | getHorzScreenDPI (void) const
| Return the horizontal display resolution dpi.
virtual uint | getVertScreenDPI (void) const
| Return the vertical display resolution dpi.
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.

## Classes

struct | QuadInfo
| structure holding details about a quad to be drawn
struct | QuadVertex
| FVF structure used for all vertices.

## 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:

  | device | Pointer to the IDirect3DDevice9 interface object that will be used for all rendering
  | max_quads | Obsolete. 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_rect | Rect object describing the destination area (values are in pixels)
  | z | float value specifying the z co-ordinate / z order of the quad
  | tex | pointer to the Texture object that holds the imagery to be rendered
  | texture_rect | Rect object holding the area of tex that is to be rendered (values are in texture co-ordinates).
  | colours | ColourRect object describing the colour values that are to be applied when rendering.
  | quad_split_mode | One 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 | ( | float | size | ) | `[virtual]`

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

Parameters:

  | size | float 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.

Texture * CEGUI::DirectX9Renderer::createTexture | ( | const String & | filename,
|  | const String & | resourceGroup
| ) | `[virtual]`

Create a Texture object using the given image file.

Parameters:

  | filename | String object that specifies the path and filename of the image file to use when creating the texture.
  | resourceGroup | Resource 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.

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.

void CEGUI::DirectX9Renderer::destroyAllTextures | ( | void |  | ) | `[virtual]`

Destroy all Texture objects.

Returns:
  Nothing

Implements CEGUI::Renderer.

void CEGUI::DirectX9Renderer::destroyTexture | ( | Texture * | texture | ) | `[virtual]`

Destroy the given Texture object.

Parameters:

  | texture | pointer to the Texture object to be destroyed

Returns:
  Nothing

Implements CEGUI::Renderer.

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.

virtual float CEGUI::DirectX9Renderer::getHeight | ( | void |  | ) | const`[inline, virtual]`

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`[inline, virtual]`

Return the horizontal display resolution dpi.

Returns:
  horizontal resolution of the display in dpi.

Implements CEGUI::Renderer.

virtual uint CEGUI::DirectX9Renderer::getMaxTextureSize | ( | void |  | ) | const`[inline, virtual]`

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`[inline, virtual]`

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`[inline, virtual]`

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`[inline, virtual]`

Return the vertical display resolution dpi.

Returns:
  vertical resolution of the display in dpi.

Implements CEGUI::Renderer.

virtual float CEGUI::DirectX9Renderer::getWidth | ( | void |  | ) | const`[inline, virtual]`

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`[inline, virtual]`

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:

  | sz | Size object describing the size of the display.

Returns:
  Nothing.

virtual void CEGUI::DirectX9Renderer::setQueueingEnabled | ( | bool | setting | ) | `[inline, virtual]`

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:

  | setting | true to enable queueing, or false to disable queueing (see notes above).

Returns:
  Nothing

Implements CEGUI::Renderer.