?? setother.cpp
字號:
//--------------------------------------------------------------
/**\!File
*
*File name:SETOTHER.cpp
*
*His:add by honghaier @2004/5/11
*
*Desc:設置游戲控制界面類
*/
//---------------------------------------------------------------
#include "SetOther.h"
#include "BASIC.h"
//---------------------------------------------------------------
CSetOther::CSetOther()
{
m_pD3DDevice=NULL;
m_pFont1=NULL;//字體
m_pFont2=NULL;//字體
m_pFontkey=NULL;//字體
}
CSetOther::~CSetOther()
{
SAFE_DELETE(m_pFont1);
SAFE_DELETE(m_pFont2);
SAFE_DELETE(m_pFontkey);
}
/**!\brief
*初始化
*/
bool CSetOther::init(LPDIRECT3DDEVICE8 pd3dDevice)
{
m_level=1;
m_rownum=1;
m_playernum=1;
m_addrow=false;
m_shownext=true;
m_pD3DDevice=pd3dDevice;
lstrcpy( m_strFont, _T("Arial Black") );
m_dwFontSize = 40;
m_pFont1= new CD3DFont( m_strFont, m_dwFontSize );
m_pFont1->InitDeviceObjects(m_pD3DDevice);
m_pFont1->RestoreDeviceObjects();
lstrcpy( m_strFont, _T("Arial") );
m_dwFontSize = 20;
m_pFont2= new CD3DFont( m_strFont, m_dwFontSize );
m_pFont2->InitDeviceObjects(m_pD3DDevice);
m_pFont2->RestoreDeviceObjects();
lstrcpy( m_strFont, _T("System") );
m_dwFontSize = 15;
m_pFontkey= new CD3DFont( m_strFont, m_dwFontSize );
m_pFontkey->InitDeviceObjects(m_pD3DDevice);
m_pFontkey->RestoreDeviceObjects();
return true;
}
/**!\brief
*渲染
*/
void CSetOther::Render()
{
m_pFont1->DrawText(80,50, D3DCOLOR_ARGB(255,255,255,0),"1.LEVEL");
m_pFontkey->DrawText(80,130, D3DCOLOR_ARGB(255,0,255,0),"please input the Level: Mouse on this");
for(int i=0;i<10;i++)
{
m_pFontkey->DrawText(400+i*10,130, D3DCOLOR_ARGB(100,0,255,0),"|");
}
for(int i1=0;i1<m_level;i1++)
{
m_pFontkey->DrawText(400+i1*10,130, D3DCOLOR_ARGB(255,0,255,0),"|");
}
m_pFontkey->DrawText(400,100, D3DCOLOR_ARGB(255,255,0,0),"now level:");
char info[50];
wsprintf(info,"%d",m_level);
m_pFontkey->DrawText(500,100, D3DCOLOR_ARGB(255,255,0,255),info);
m_pFont1->DrawText(80,150, D3DCOLOR_ARGB(255,255,255,0),"2.ROW");
m_pFontkey->DrawText(80,230, D3DCOLOR_ARGB(255,0,255,0),"please input the Row: Mouse on this");
for(int j=0;j<10;j++)
{
m_pFontkey->DrawText(400+j*10,230, D3DCOLOR_ARGB(100,0,255,0),"|");
}
for(int j1=0;j1<m_rownum-1;j1++)
{
m_pFontkey->DrawText(400+j1*10,230, D3DCOLOR_ARGB(255,0,255,0),"|");
}
m_pFontkey->DrawText(400,200, D3DCOLOR_ARGB(255,255,0,0),"now row:");
char info2[50];
wsprintf(info2,"%d",m_rownum-1);
m_pFontkey->DrawText(500,200, D3DCOLOR_ARGB(255,255,0,255),info2);
m_pFont1->DrawText(80,250, D3DCOLOR_ARGB(255,255,255,0),"3.MODE");
m_pFontkey->DrawText(400,300, D3DCOLOR_ARGB(255,255,0,0),"now mode:");
if(m_addrow==true)
{
m_pFontkey->DrawText(400,330, D3DCOLOR_ARGB(255,255,25,255),"1.ADD ROW TO ANOTHER");
}
else
{
m_pFontkey->DrawText(400,330, D3DCOLOR_ARGB(255,255,25,255),"1.NOT ADD ROW TO ANOTHER");
}
if(m_shownext==true)
{
m_pFontkey->DrawText(400,360, D3DCOLOR_ARGB(255,255,25,255),"2.SHOW NEXT TILE");
}
else
{
m_pFontkey->DrawText(400,360, D3DCOLOR_ARGB(255,255,25,255),"2.NOT SHOW NEXT TILE");
}
if(m_playernum==1)
{
m_pFontkey->DrawText(400,390, D3DCOLOR_ARGB(255,255,25,255),"3.ONE PLAYER");
}
else
{
m_pFontkey->DrawText(400,390, D3DCOLOR_ARGB(255,255,25,255),"3.TWO PLAYERS");
}
if(m_selected==31)
{
m_addrow=true;
m_pFontkey->DrawText(80,330, D3DCOLOR_ARGB(255,255,255,0),"1.ADD ROW TO ANOTHER");
}
else
{
m_pFontkey->DrawText(80,330, D3DCOLOR_ARGB(255,0,255,0),"1.ADD ROW TO ANOTHER");
}
if(m_selected==32)
{
m_addrow=false;
m_pFontkey->DrawText(80,360, D3DCOLOR_ARGB(255,255,255,0),"1.NOT ADD ROW TO ANOTHER");
}
else
{
m_pFontkey->DrawText(80,360, D3DCOLOR_ARGB(255,0,255,0),"1.NOT ADD ROW TO ANOTHER");
}
if(m_selected==33)
{
m_shownext=true;
m_pFontkey->DrawText(80,390, D3DCOLOR_ARGB(255,255,255,0),"2.SHOW NEXT TILE");
}
else
{
m_pFontkey->DrawText(80,390, D3DCOLOR_ARGB(255,0,255,0),"2.SHOW NEXT TILE");
}
if(m_selected==34)
{
m_shownext=false;
m_pFontkey->DrawText(80,420, D3DCOLOR_ARGB(255,255,255,0),"2.NOT SHOW NEXT TILE");
}
else
{
m_pFontkey->DrawText(80,420, D3DCOLOR_ARGB(255,0,255,0),"2.NOT SHOW NEXT TILE");
}
if(m_selected==35)
{
m_playernum=1;
m_pFontkey->DrawText(80,450, D3DCOLOR_ARGB(255,255,255,0),"3.--->ONE PLAYER");
}
else
{
m_pFontkey->DrawText(80,450, D3DCOLOR_ARGB(255,0,255,0),"3.--->ONE PALYER");
}
if(m_selected==36)
{
m_playernum=2;
m_pFontkey->DrawText(80,480, D3DCOLOR_ARGB(255,255,255,0),"3.--->TWO PALYERS");
}
else
{
m_pFontkey->DrawText(80,480, D3DCOLOR_ARGB(255,0,255,0),"3.--->TOW PLAYERS");
}
if(m_selected==40)
{
m_pFont2->DrawText(600,450, D3DCOLOR_ARGB(255,0,0,255),"START GAME");
}
else
{
m_pFont2->DrawText(600,450, D3DCOLOR_ARGB(255,0,255,255),"START GAME");
}
}
/**!\brief
*釋放
*/
void CSetOther::CleanUp()
{
SAFE_DELETE(m_pFont1);
SAFE_DELETE(m_pFont2);
SAFE_DELETE(m_pFontkey);
}
/**!\brief
*選取
*/
void CSetOther::Selected(int _t)
{
m_selected=_t;
}
/**!\brief
*選取
*/
void CSetOther::MoveLevel(int _t)
{
m_level=_t;
}
/**!\brief
*選取
*/
void CSetOther::MoveRow(int _t)
{
m_rownum=_t;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -