📄 cmenu.cpp
字号:
#include "CMenu.h"
#include "resource.h"
#include "Msghelp.h"
#include "CAppWnd.h"
#include "CD3DApp.h"
#include "CSnapshot.h"
#include "CGameManager.h"
#include "CGameState.h"
extern CAppWnd theAppWnd;
extern CD3DApp theD3DApp;
extern CSnapshot theSnapshot;
extern CGameManager theGameManager;
extern CGameState theGameState;
CMenu::CMenu()
{
m_iTemplate = IDR_MENU1;
}
CMenu::~CMenu()
{
}
bool CMenu::Init( HWND hwnd, HINSTANCE hInstance )
{
if ( m_hmenu == NULL && m_iTemplate != 0 )
{
m_hmenu = LoadMenu( hInstance, MAKEINTRESOURCE( m_iTemplate ) );
if ( m_hmenu == NULL )
return false;
return true;
}
return false;
}
bool CMenu::HandleMsg( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch ( wParam )
{
//"文件选项"
case MU_EXIT:
SendMessage( hwnd, WM_CLOSE, 0, 0 );
break;
case MU_NEW_GAME:
theGameManager.ReStart();
break;
case MU_PAUSE:
theGameState.PauseGame();
break;
case MU_SNAPSHOT:
theSnapshot.EnableSnapshot();
break;
case MU_HELP:
Warn( "四个方向健控制方块,回车健暂停游戏" );
break;
case MU_ABOUT:
Warn( "卢杭威宇(小小C)编程作品" );
break;
case MU_HOME_PAGE:
ShellExecute( NULL, NULL, "http://mysticc.icpcn.com", NULL, NULL, SW_SHOW );
break;
}
return true;
}
void CMenu::Free()
{
if ( m_hmenu != NULL )
{
DestroyMenu( m_hmenu );
m_hmenu = NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -