#include <Menu.h>
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. |
Main Menu in this game uses two dimensional buttons (see C2DButton class).
CMenu::CMenu | ( | ) |
CMenu standard constructor.
All menu varibles are initialized to 0 or alike. To see some real initialization check out CMenu::Init() function.
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.
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.
bool CMenu::OnEvent | ( | LPDIRECT3DDEVICE9 | pd3dDevice, | |
HWND | hWnd, | |||
UINT | msg, | |||
WPARAM | wParam, | |||
LPARAM | lParam, | |||
int * | code | |||
) |
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.
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.
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.
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.
void CMenu::Restart | ( | ) |
This function restarts displaying of Menu.