CMenu Class Reference

Menu class. This class draws Main Menu GUI and handles user input. More...

#include <Menu.h>

Collaboration diagram for CMenu:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CMenu ()
 ~CMenu ()
bool Init (HWND hWnd, LPDIRECT3DDEVICE9 device, int screenWidth, int screenHeight, IDirectSound8 *pDS, float dificulty, bool details, bool fullscreen, CTurtle *pTurtle, CLanguage *language)
bool OnEvent (LPDIRECT3DDEVICE9 pd3dDevice, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, int *code)
 This function catches events for menu. Menu could react on arrow keys, mouse move, etc...
void OnFrameMove (LPDIRECT3DDEVICE9 pd3dDevice, double fTime, float fElapsedTime)
 OnFrameMove is required for menu only if there is some sort of animation involved: button onmouseover transition can be smooth or 3D objects could be animated, also credits text can move up in lines like in movies.
void OnRender (LPDIRECT3DDEVICE9 pd3dDevice)
 Renders the main menu screeen of the game. There can be title, buttons, 3D buttons, images and 3D objects as well.
void OnResetDevice (int screenWidth, int screenHeight)
 This function is called when 3D device is reset. Its important to call this function AFTER device is reset, like when switching to/from fullscreen mode.
void OnLostDevice ()
 This function is called when 3D device is lost. Its important to call this function BEFORE device is reset, like when switching to/from fullscreen mode.
void Restart ()
 This function restarts displaying of Menu.


Detailed Description

Menu class. This class draws Main Menu GUI and handles user input.

Main Menu in this game uses two dimensional buttons (see C2DButton class).

Author:
Petar Bajic
Date:
January, 16 2007.

Constructor & Destructor Documentation

CMenu::CMenu (  ) 

CMenu standard constructor.

All menu varibles are initialized to 0 or alike. To see some real initialization check out CMenu::Init() function.

Author:
Petar Bajic
Date:
January, 16 2007.

CMenu::~CMenu (  ) 

CLevel destructor. Deletes all that has been alocated in Menu class. If you get memleak error after exiting program - here is the problem.

Author:
Petar Bajic
Date:
January, 16 2007.


Member Function Documentation

bool CMenu::Init ( HWND  hWnd,
LPDIRECT3DDEVICE9  device,
int  screenWidth,
int  screenHeight,
IDirectSound8 *  pDS,
float  dificulty,
bool  details,
bool  fullscreen,
CTurtle pTurtle,
CLanguage language 
)

Init function initializes all menu components. Music is loaded, buttons are created, everything is allocated here. Some models are allocated before CMenu::Init (like turtle) because they are needed elsewhere (in movie, level, etc.) These models are sent to Init as pointers (pTurtle), so CMenu can use them instead of doing new allocation.

Author:
Petar Bajic
Date:
January, 16 2007.

bool CMenu::OnEvent ( LPDIRECT3DDEVICE9  pd3dDevice,
HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
int *  code 
)

This function catches events for menu. Menu could react on arrow keys, mouse move, etc...

Parameters:
code CMenu notifies CGame about event type with this parameter.
Author:
Petar Bajic
Date:
January, 16 2007.

void CMenu::OnFrameMove ( LPDIRECT3DDEVICE9  pd3dDevice,
double  fTime,
float  fElapsedTime 
)

OnFrameMove is required for menu only if there is some sort of animation involved: button onmouseover transition can be smooth or 3D objects could be animated, also credits text can move up in lines like in movies.

Author:
Petar Bajic
Date:
January, 16 2007.

void CMenu::OnRender ( LPDIRECT3DDEVICE9  pd3dDevice  ) 

Renders the main menu screeen of the game. There can be title, buttons, 3D buttons, images and 3D objects as well.

Author:
Petar Bajic
Date:
January, 16 2007.

void CMenu::OnResetDevice ( int  screenWidth,
int  screenHeight 
)

This function is called when 3D device is reset. Its important to call this function AFTER device is reset, like when switching to/from fullscreen mode.

Author:
Petar Bajic
Date:
January, 16 2007.

void CMenu::OnLostDevice (  ) 

This function is called when 3D device is lost. Its important to call this function BEFORE device is reset, like when switching to/from fullscreen mode.

Author:
Petar Bajic
Date:
January, 16 2007.

void CMenu::Restart (  ) 

This function restarts displaying of Menu.

Author:
Petar Bajic
Date:
January, 16 2007.


The documentation for this class was generated from the following files:
Generated on Wed Mar 26 16:00:54 2008 for Turtle Shepherd by  doxygen 1.5.3