- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# C2DButton Class Reference

2D Button class. More...

`#include <Button.h>`

Inheritance diagram for C2DButton:

[legend]
Collaboration diagram for C2DButton:

[legend]

List of all members.

## Public Member Functions
| C2DButton ()
| Standard constructor.
bool | Init (HWND hWnd, RECT box, bool visible, bool enabled, WCHAR *caption, RECT textBox, LPDIRECT3DTEXTURE9 tex, LPDIRECT3DTEXTURE9 texOver, IDirectSound8 *pDS, LPWSTR clickSoundFilename, LPWSTR focusSoundFilename, int type)
| Initialize button object.
bool | OnEvent (UINT uMsg, WPARAM wParam, LPARAM lParam)
| OnEvent should handle events like mouse click and mouse over. For button to handle these events, button class must contain info about button position, size, etc.
void | OnRender (LPDIRECT3DDEVICE9 pd3dDevice, LPD3DXSPRITE pSprite, LPD3DXFONT pFont, D3DXVECTOR2 *scaling, D3DXVECTOR2 *trans, D3DXVECTOR2 *spriteCentre, float rotation)
| Render button on the screen (d3ddevice). 2D buttons are drawn on sprites. They have texture and caption.
void | OnFrameMove (LPDIRECT3DDEVICE9 pd3dDevice, float fElapsedTime)
| OnFrameMove defines button animation (if any). In this case, buttons are shaken when in focus.

## Detailed Description

2D Button class.

Represents 2D buttons with textures.

Author:
  Petar Bajic

Date:
  January, 16 2007.

## Constructor & Destructor Documentation

C2DButton::C2DButton | ( |  | ) |

Standard constructor.

Author:
  Petar Bajic

Date:
  January, 16 2007.

## Member Function Documentation

bool C2DButton::Init | ( | HWND | hWnd,
|  | RECT | box,
|  | bool | visible,
|  | bool | enabled,
|  | WCHAR * | caption,
|  | RECT | textBox,
|  | LPDIRECT3DTEXTURE9 | tex,
|  | LPDIRECT3DTEXTURE9 | texOver,
|  | IDirectSound8 * | pDS,
|  | LPWSTR | clickSoundFilename,
|  | LPWSTR | focusSoundFilename,
|  | int | type |
| ) |  |  |

Initialize button object.

Parameters:

  | type | MPE_BUTTON_TYPE enum variable.

Author:
  Petar Bajic

Date:
  January, 16 2007.

bool C2DButton::OnEvent | ( | UINT | uMsg,
|  | WPARAM | wParam,
|  | LPARAM | lParam |
| ) |  |  | `[virtual]`

OnEvent should handle events like mouse click and mouse over. For button to handle these events, button class must contain info about button position, size, etc.

Author:
  Petar Bajic

Date:
  January, 16 2007.

Reimplemented from CButton.

void C2DButton::OnRender | ( | LPDIRECT3DDEVICE9 | pd3dDevice,
|  | LPD3DXSPRITE | pSprite,
|  | LPD3DXFONT | pFont,
|  | D3DXVECTOR2 * | pScaling,
|  | D3DXVECTOR2 * | pTrans,
|  | D3DXVECTOR2 * | spriteCentre,
|  | float | rotation |
| ) |  |  |

Render button on the screen (d3ddevice). 2D buttons are drawn on sprites. They have texture and caption.

Author:
  Petar Bajic

Date:
  January, 16 2007.

void C2DButton::OnFrameMove | ( | LPDIRECT3DDEVICE9 | pd3dDevice,
|  | float | fElapsedTime |
| ) |  |  | `[virtual]`

OnFrameMove defines button animation (if any). In this case, buttons are shaken when in focus.

Author:
  Petar Bajic

Date:
  January, 16 2007.

Reimplemented from CButton.

The documentation for this class was generated from the following files:

- My Documents/TS2/inc/Button.h
- My Documents/TS2/src/Button.cpp