📄 interfa2.cpp
字号:
extern CDDMenu Menu_System_Load;
extern CDDMenu Menu_System_Query;
extern CDDMenu Menu_System_Query_General_1;
extern CDDMenu Menu_System_Query_General_2;
extern CDDMenu Menu_System_Query_Army;
extern CDDMenu Menu_System_Query_Building;
extern CDDMenu Menu_System_Query_Campaign_Mission;
extern CDDMenu Menu_System_Option;
extern CDDMenu Menu_System_Help;
extern CDDMenu Menu_System_Help_Operate;
extern CDDMenu Menu_System_Help_Icon;
extern CDDMenu Menu_System_Help_Game;
extern CDDMenu Menu_System_Exit;
///////////////////////////
// menu to select general
extern CDDMenu Menu_Select_General;
// menu to show the information of the generals want to single battle
extern CDDMenu Menu_Single ;
extern CDDMenu Menu_Single_Reject ;
extern CDDMenu Menu_Single_Result ;
/////////////////////////////////////
// menu to show some error and prompt information
extern CDDMenu Menu_Link_Error ;
/////////////////////////////////////
// to store the six golbal list pointers for establish menu
////////////////////////////////////
/*class CDDList * pEstablishList_1;
class CDDList * pEstablishList_2;
class CDDList * pEstablishList_3;
class CDDList * pEstablishList_4;
class CDDList * pEstablishList_5;
class CDDList * pEstablishList_6;
*/
//////////////////////////////////////////////////////
// mouse function
////////////////////////////////////////
// to test whether a button is clicked
/////////////////////////////////////////
BOOL FACE_LeftButtonDown(int xPos, int yPos)
{
if( FACE_GetCommandState() == COMMAND_STATE_MENU &&
CurrentMenu == &Menu_Select_General )
{
if( xPos<495 || xPos>623 || yPos<153 || yPos>458 )
{ // 选择将领菜单之外
SendMessage( hwndGame, WM_COMMAND, BUTTON_SELECT_GENERAL_CANCEL, 0 ) ;
}
}
if( (FACE_GetCommandState() == COMMAND_STATE_MENU)||
(FACE_GetCommandState() == COMMAND_STATE_DIALOG)
)
{
//////////////////////////
// I must to detect scroll-bar before button
// so keep the sequence of the following lines
if( LeftButtonDownOnScrollBar(xPos, yPos) )
return TRUE;
if( LeftButtonDownOnButton(xPos, yPos) )
return TRUE;
/////////////////////////
if( LeftButtonDownOnComboBox(xPos, yPos) )
return TRUE;
if( LeftButtonDownOnCheckBox(xPos, yPos) )
return TRUE;
if( LeftButtonDownOnList( xPos, yPos) )
return TRUE;
return FALSE;
}
else if( xPos<50 || xPos>450 || yPos< 100 )
return LeftButtonDownOnButton(xPos, yPos);
else
return FALSE;
}
// to test whether cursor is on current button when left button up
BOOL FACE_LeftButtonUp(int xPos, int yPos)
{
if( (FACE_GetCommandState() == COMMAND_STATE_MENU)||
(FACE_GetCommandState() == COMMAND_STATE_DIALOG)
)
{
if( LeftButtonUpOnCheckBox(xPos, yPos) )
return TRUE;
if( LeftButtonUpOnButton(xPos, yPos) )
return TRUE;
return FALSE;
}
else if( xPos<50 || xPos>450 || yPos< 100 )
// to test whether cursor is on current button when left button up
return LeftButtonUpOnButton(xPos, yPos);
else
return FALSE;
}
// to test whether cursor is moved on a button
BOOL FACE_MouseMove(WPARAM wParam, int xPos, int yPos)
{
static BOOL IsShowGeneralPrompt = FALSE ;
if( (FACE_GetCommandState() == COMMAND_STATE_MENU) ||
(FACE_GetCommandState() == COMMAND_STATE_DIALOG)
)
{
// to test whether cursor is moved on a check-box --- WM_ONMOUSEMOVE
if( MouseMoveOnList( xPos, yPos) )
return TRUE;
if( MouseMoveOnButton(xPos, yPos) )
return TRUE;
if( MouseMoveOnComboBox(xPos, yPos) )
return TRUE;
if( MouseMoveOnCheckBox(wParam, xPos, yPos) )
return TRUE;
return FALSE;
}
//////////////////////////////////////////////
// to add the following lines just for the Japanese
// July.24.1997
else if( (IsShowGeneralPrompt == TRUE)&&
( ( 504>xPos ) || ( xPos>565 ) || ( 161>yPos ) || ( yPos>249 ) )
)
{
// to update the bottom block of interfac
FACE_UpdateMessageRect() ;
// to set this flag to false
IsShowGeneralPrompt = FALSE ;
return TRUE ;
}
else if( ( FACE_GetCommandState() == COMMAND_STATE_PLAY )&&
( FACE_bMessageBox == FALSE ) &&
( 504<xPos ) &&
( xPos<565 ) &&
( 161<yPos ) &&
( yPos<249 ) &&
( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_UNIT ) &&
( IsShowGeneralPrompt == FALSE )
)
{
static BOOL ShowPrompt = FALSE ;
IsShowGeneralPrompt = TRUE ;
if( ShowPrompt == TRUE )
return TRUE ;
// to update the bottom block of interfac
FACE_UpdateMessageRect() ;
CText_apply Text;
char tl[256] ; //体力
char wl[256] ; //武力
memset (tl,0,sizeof(tl));
memset (wl,0,sizeof(wl));
Text.Text_open ("set\\hz.ext");
Text.Text_use (tl,32);
Text.Text_use (wl,33);
Text.Text_close ();
class CDDText prompt_text; // the prompt string
int iResult = prompt_text.BeginText( 128 );
if( ! iResult )
return FALSE;
// to set the color of this text show
prompt_text.SetTextColor( RGB(255, 255, 120) );
prompt_text.MyTextOut(DD_GetBackBuffer(), 30, 460, wl);
prompt_text.GetDDSurface()->Erase();
prompt_text.MyTextOut(DD_GetBackBuffer(), 200, 460, tl);
prompt_text.GetDDSurface()->Erase();
char tl_1[256] ;
char wl_1[256] ;
memset( tl_1, 0, sizeof(tl_1) ) ;
memset( wl_1, 0, sizeof(wl_1) ) ;
_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralPower, wl_1, 10 ) ;
_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralBlood, tl_1, 10 ) ;
prompt_text.SetTextColor( RGB(255, 255, 250) );
prompt_text.MyTextOut(DD_GetBackBuffer(), 100, 460, wl_1);
prompt_text.GetDDSurface()->Erase();
prompt_text.MyTextOut(DD_GetBackBuffer(), 270, 460, tl_1);
prompt_text.GetDDSurface()->Erase();
prompt_text.EndText();
sBottom.Update();
return TRUE ;
}
else if( xPos<50 || xPos>450 || yPos< 100 )
return MouseMoveOnButton(xPos, yPos);
else
return FALSE;
}
// to test whether cursor is select a general for the team that you want to establish
BOOL FACE_LeftButtonDoubleClick(WPARAM wParam, int xPos, int yPos)
{
if( GAME.nCommandState != COMMAND_STATE_MENU )
{
if( xPos<50 || xPos>450 || yPos< 100 )
return LeftButtonDownOnButton(xPos, yPos);
else
return FALSE ;
}
// to place this line here to resolve the problem of LEFT-BUTTON-DOUBLE-CLICK send one wm_lbutdown, one wm_lbutdblclk and two wm_lbutup
if( LeftButtonDownOnCheckBox(xPos, yPos) )
return TRUE;
// I must to detect scroll-bar before button
// so keep the sequence of the following lines
if( LeftButtonDownOnScrollBar(xPos, yPos) )
return TRUE;
if( LeftButtonDownOnButton(xPos, yPos) )
return TRUE;
// TODO: Add your message handler code here and/or call default
if( CurrentMenu == &Menu_Select_General )
{
if( LeftButtonDownOnList( xPos, yPos) )
{
CurrentMenu = NULL;
// Menu_Select_General.Release();
FACE_SetProgramState(PROGRAM_STATE_PLAY);
FACE_SetCommandState(COMMAND_STATE_PLAY);
FACE_RestoreAllButtonState();
// to set the state of all buttons in this menu's button-unit
Menu_Select_General.m_MenuButtonUnit.SetMemberState( BUTTON_DISABLE );
int temp = pAllListUnit[0]->m_nSerialNum;
if( (temp != NONE)&&(pAllGeneral[ ToPageAllGeneral(GET_CURRENT)+temp ] != NULL ) )
SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT,
pAllGeneral[ ToPageAllGeneral(GET_CURRENT)+temp ]->nID );
else
SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT, 0 );
pAllListUnit[0]->m_pList[0]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[1]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[2]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[3]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[4]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[5]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[0] = NULL ;
pAllListUnit[0]->m_pList[1] = NULL ;
pAllListUnit[0]->m_pList[2] = NULL ;
pAllListUnit[0]->m_pList[3] = NULL ;
pAllListUnit[0]->m_pList[4] = NULL ;
pAllListUnit[0]->m_pList[5] = NULL ;
FACE_DeleteAllList();
// FACE_DeleteAllList();
FACE_ShowRightBlock();
MINI_Update(FALSE);
sRight.Update();
return TRUE ;
}
}
if( LeftButtonDownOnList( xPos, yPos) )
return TRUE;
return FALSE ;
}
void FACE_RightButtonDown(WPARAM wParam, int xPos, int yPos)
{
// TODO: Add your message handler code here and/or call default
if( CurrentMenu == &Menu_Select_General )
{
CurrentMenu = NULL;
FACE_RestoreAllButtonState();
// to set the state of all buttons in this menu's button-unit
Menu_Select_General.m_MenuButtonUnit.SetMemberState( BUTTON_DISABLE );
FACE_SetProgramState(PROGRAM_STATE_PLAY);
FACE_SetCommandState(COMMAND_STATE_PLAY);
pAllListUnit[0]->m_pList[0]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[1]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[2]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[3]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[4]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[5]->SetState(LIST_DISABLE) ;
pAllListUnit[0]->m_pList[0] = NULL ;
pAllListUnit[0]->m_pList[1] = NULL ;
pAllListUnit[0]->m_pList[2] = NULL ;
pAllListUnit[0]->m_pList[3] = NULL ;
pAllListUnit[0]->m_pList[4] = NULL ;
pAllListUnit[0]->m_pList[5] = NULL ;
FACE_DeleteAllList();
FACE_ShowRightBlock();
MINI_Update(FALSE);
sRight.Update();
SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT, 0 );
}
}
////////////////////////////////////////////////////////////////////
// to manage the input string
BOOL FACE_IsInputString( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
if( FACE_GetProgramState() == PROGRAM_STATE_PAUSE )
return FALSE ;
if( ( FACE_GetCommandState() != COMMAND_STATE_DIALOG )&&
( FACE_bMessageBox != TRUE )&&
( CurrentMenu != &Menu_NetWork_SetNet )
)
return FALSE;
if( ( FACE_GetProgramState() == PROGRAM_STATE_MENU )&&
( CurrentMenu == &Menu_NetWork_InputName )
)
{
switch(wParam)
{
case 0x08: // Backspace
// move the caret back one space, and then process this like the DEL key
if( DIALOG_LETTER_X > 0 )
{
DIALOG_BUF[DIALOG_LETTER_X - 1] = DIALOG_BUF[DIALOG_LETTER_X];
DIALOG_BUF[DIALOG_LETTER_X] = '\0';
DIALOG_LETTER_X--;
// draw the character on the screen
FACE_Echo_prompt(hwnd);
}
break;
case 0x1B: // Escape
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -