Inherits AbstractRenderer.
Public Member Functions | |
virtual void | BeginRendering () |
Can be implemented to begin rendering the scene, this may include doing things like clearing the back buffer, setting up any global transforms etc etc. | |
virtual void | EndRendering () |
Can be implemented to finalize rendering, this may include presenting the display by flipping the buffers. | |
virtual void | SetClearColour (const Colour &c) |
Sets the clear colour, the clear colour is the colour that the backbuffer should be cleared to upon each call to BeginRendering(). | |
virtual void | DrawLines (const LineVertex *pVertices, const int nNumPoints, const int nWidth, const float fTranslateX, const float fTranslateY, const float fRotation) |
Can be used to draw basic lines to the screen. | |
virtual void | DrawSprite (const Sprite *pSprite, ResourceCache *const pResourceCache, const Vector2 &position, const Vector2 ¢er, const float fRotation, const float fScaleX, const float fScaleY) |
Used to draw sprites, or two-dimensional images to the screen. | |
virtual void | DrawString (const std::wstring &text, const std::string &font, const int nSize, const Vector2 &position, const int nAlignment, const Colour &c, bool bBold, bool bItalic) |
Used to draw a single line of text to the screen. | |
virtual void | DrawText (const std::wstring &text, const std::string &font, const int nSize, const Rect &rect, const int nAlignment, Colour &c, bool bBold, bool bItalic) |
Used to draw multiple lines of text to the screen. | |
virtual void | DrawModel (const PTModel &model, const Vector2 &translation, const float fRotation, const float fScale) |
Used to draw a model to the screen. | |
virtual bool | CanRender () |
Used by the engine to determine whether rendering can be done, if this function returns false then the engine will pause the game until it returns true. | |
virtual std::pair< int, int > | GetResolution () |
Used be the engine to determine the current screen resolution. | |
virtual void | ClearArea (const Rect &rect, const Colour &c) |
Can be used to clear a specific area on the backbuffer. | |
virtual int | GetStringWidth (const std::wstring &textString, const std::string &font, const int nFontHeight, bool bBold, bool bItalic) |
A helper function which asks the renderer how long a string will be (in pixels) when it it is drawn to the screen. | |
void | Reset () |
HRESULT | InitializeD3D (HWND hWnd, INT nWidth, INT nHeight, D3DFORMAT backBufferFmt, D3DMULTISAMPLE_TYPE multisampling, BOOL bWindowed) |
Friends | |
class | TextureResourceListener |
bool D3DRenderer::CanRender | ( | ) | [virtual] |
Used by the engine to determine whether rendering can be done, if this function returns false then the engine will pause the game until it returns true.
Implements AbstractRenderer.
Can be used to clear a specific area on the backbuffer.
rect | The rectangular area to clear. | |
c | The colour to clear it to. |
Implements AbstractRenderer.
void D3DRenderer::DrawLines | ( | const LineVertex * | pVertices, | |
const int | nNumPoints, | |||
const int | nWidth, | |||
const float | fTranslateX, | |||
const float | fTranslateY, | |||
const float | fRotation | |||
) | [virtual] |
Can be used to draw basic lines to the screen.
pVertices | A pointer to an array or vertices that represent the line. | |
nNumPoints | The number of vertices in the pVertices array. | |
nWidth | The width of the line. | |
fTranslateX | How to translate the points provided in the pVertices buffer in the x-direction. | |
fTranslateY | How to translate the points provides in the pVertices buffer in the y-direction. | |
fRotation | How to rotate the points provided in the pVertices buffer in radians. |
Implements AbstractRenderer.
void D3DRenderer::DrawModel | ( | const PTModel & | model, | |
const Vector2 & | translation, | |||
const float | fRotation, | |||
const float | fScale | |||
) | [virtual] |
Used to draw a model to the screen.
[i]Note: Models passed into this function should be constructed of triangles.[/i]
model | A reference to the model to be drawn. | |
translation | The position of the model (in pixels). | |
fRotation | How to rotate the model, in radians. | |
fScale | How much overall scaling to put onto the model, this should be 1 for no scaling. |
Implements AbstractRenderer.
void D3DRenderer::DrawSprite | ( | const Sprite * | pSprite, | |
ResourceCache *const | pResourceCache, | |||
const Vector2 & | position, | |||
const Vector2 & | center, | |||
const float | fRotation, | |||
const float | fScaleX, | |||
const float | fScaleY | |||
) | [virtual] |
Used to draw sprites, or two-dimensional images to the screen.
pSprite | A pointer to a sprite structure which contains details of the sprite to draw. | |
pResourceCache | A pointer to the resource cache from which the image data will be loaded. | |
position | The position on screen (in pixels) at which to draw the sprite. | |
center | The center of the sprite, this point on the sprite will be placed at position and rotated about here. | |
fRotation | How much to rotate the sprite about center. | |
fScaleX | How much to scale the sprite in the x-direction. | |
fScaleY | How much to scale the sprite in the y-direction. |
Implements AbstractRenderer.
void D3DRenderer::DrawString | ( | const std::wstring & | text, | |
const std::string & | font, | |||
const int | nSize, | |||
const Vector2 & | position, | |||
const int | nAlignment, | |||
const Colour & | c, | |||
bool | bBold, | |||
bool | bItalic | |||
) | [virtual] |
Used to draw a single line of text to the screen.
text | The string to draw. | |
font | The font to draw the text int. | |
nSize | The height of the text to draw. | |
position | The position on screen which to draw the text (in pixels). | |
nAlignment | The alignment of the text can be a combinatation of the TEXTALIGNMENT enumeration. | |
c | The colour of the text to draw. | |
bBold | Whether the text should be drawn in bold. | |
bItalic | Whether the text should be drawn in italics. |
Implements AbstractRenderer.
void D3DRenderer::DrawText | ( | const std::wstring & | text, | |
const std::string & | font, | |||
const int | nSize, | |||
const Rect & | rect, | |||
const int | nAlignment, | |||
Colour & | c, | |||
bool | bBold, | |||
bool | bItalic | |||
) | [virtual] |
Used to draw multiple lines of text to the screen.
text | The string to draw. | |
font | The font to draw the text int. | |
nSize | The height of the text to draw. | |
rect | The rectangle which to fit the text into, wrapping will be done when the text touches the edges of this rect. | |
nAlignment | The alignment of the text can be a combinatation of the TEXTALIGNMENT enumeration. | |
c | The colour of the text to draw. | |
bBold | Whether the text should be drawn in bold. | |
bItalic | Whether the text should be drawn in italics. |
Implements AbstractRenderer.
std::pair< int, int > D3DRenderer::GetResolution | ( | ) | [virtual] |
Used be the engine to determine the current screen resolution.
Implements AbstractRenderer.
int D3DRenderer::GetStringWidth | ( | const std::wstring & | textString, | |
const std::string & | font, | |||
const int | nFontHeight, | |||
bool | bBold, | |||
bool | bItalic | |||
) | [virtual] |
A helper function which asks the renderer how long a string will be (in pixels) when it it is drawn to the screen.
textString | The text to check. | |
font | The font name of the text. | |
nFontHeight | The height of the font to check. | |
bBold | Whether the calculation should be done for bold text. | |
bItalic | Whether the calculation should be done for italic text. |
Implements AbstractRenderer.
virtual void D3DRenderer::SetClearColour | ( | const Colour & | c | ) | [inline, virtual] |
Sets the clear colour, the clear colour is the colour that the backbuffer should be cleared to upon each call to BeginRendering().
c | The colour to clear to. |
Implements AbstractRenderer.