📄 game_in_minigui.c
字号:
},
{
"static",
WS_VISIBLE | SS_CENTER,
SETTING_TABLE_ORIGINX,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*3,
SETTING_TABLE_WIDTH1,
SETTING_TABLE_HEIGHT,
IDC_STATIC,
"左",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*3,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_LEFT_1,
NULL,
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*3,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_LEFT_2,
NULL,
0
},
{
"static",
WS_VISIBLE | SS_CENTER,
SETTING_TABLE_ORIGINX,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*4,
SETTING_TABLE_WIDTH1,
SETTING_TABLE_HEIGHT,
IDC_STATIC,
"右",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*4,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_RIGHT_1,
NULL,
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*4,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_RIGHT_2,
NULL,
0
},
{
"static",
WS_VISIBLE | SS_CENTER,
SETTING_TABLE_ORIGINX,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*5,
SETTING_TABLE_WIDTH1,
SETTING_TABLE_HEIGHT,
IDC_STATIC,
"旋转",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*5,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_ROTATE_1,
NULL,
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*5,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_ROTATE_2,
NULL,
0
},
{
"static",
WS_VISIBLE | SS_CENTER,
SETTING_TABLE_ORIGINX,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*6,
SETTING_TABLE_WIDTH1,
SETTING_TABLE_HEIGHT,
IDC_STATIC,
"暂停",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*6,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_PAUSE_1,
NULL,
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*6,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_PAUSE_2,
NULL,
0
},
{
"static",
WS_VISIBLE | SS_CENTER,
SETTING_TABLE_ORIGINX,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*7,
SETTING_TABLE_WIDTH1,
SETTING_TABLE_HEIGHT,
IDC_STATIC,
"开始",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*7,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_START_1,
NULL,
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*7,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDC_START_2,
NULL,
0
},
{
"button",
WS_VISIBLE | BS_PUSHBUTTON | BS_DEFPUSHBUTTON | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*8,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDOK,
"确定",
0
},
{
"button",
WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
SETTING_TABLE_ORIGINX+SETTING_TABLE_WIDTH1+SETTING_TABLE_WIDTH2,
SETTING_TABLE_ORIGINY+SETTING_TABLE_HEIGHT*8,
SETTING_TABLE_WIDTH2,
SETTING_TABLE_HEIGHT,
IDCANCEL,
"取消",
0
}
};
static void DialogKeySetting(HWND hWnd)
{
DlgKeySetting.controls = CtrlKeySetting;
theApp.bBusy=TRUE;
if(DialogBoxIndirectParam (&DlgKeySetting, hWnd, DialogKeySettingProc, 0L))
SaveSettingvalue();
theApp.bBusy=FALSE;
}
static int
DialogKeySettingProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
int iCtrlID;
char strText[50];
static KeySetting tempKeySetting[2];
switch (message) {
case MSG_INITDIALOG:
ConvertScanCode(theApp.KeySetting1.iKeyRotate,strText);
SetDlgItemText(hDlg,IDC_ROTATE_1,strText);
tempKeySetting[0].iKeyRotate = theApp.KeySetting1.iKeyRotate;
ConvertScanCode(theApp.KeySetting2.iKeyRotate,strText);
SetDlgItemText(hDlg,IDC_ROTATE_2,strText);
tempKeySetting[1].iKeyRotate = theApp.KeySetting2.iKeyRotate;
ConvertScanCode(theApp.KeySetting1.iKeyDown,strText);
SetDlgItemText(hDlg,IDC_DOWN_1,strText);
tempKeySetting[0].iKeyDown = theApp.KeySetting1.iKeyDown;
ConvertScanCode(theApp.KeySetting2.iKeyDown,strText);
SetDlgItemText(hDlg,IDC_DOWN_2,strText);
tempKeySetting[1].iKeyDown = theApp.KeySetting2.iKeyDown;
ConvertScanCode(theApp.KeySetting1.iKeyLeft,strText);
SetDlgItemText(hDlg,IDC_LEFT_1,strText);
tempKeySetting[0].iKeyLeft = theApp.KeySetting1.iKeyLeft;
ConvertScanCode(theApp.KeySetting2.iKeyLeft,strText);
SetDlgItemText(hDlg,IDC_LEFT_2,strText);
tempKeySetting[1].iKeyLeft = theApp.KeySetting2.iKeyLeft;
ConvertScanCode(theApp.KeySetting1.iKeyRight,strText);
SetDlgItemText(hDlg,IDC_RIGHT_1,strText);
tempKeySetting[0].iKeyRight = theApp.KeySetting1.iKeyRight;
ConvertScanCode(theApp.KeySetting2.iKeyRight,strText);
SetDlgItemText(hDlg,IDC_RIGHT_2,strText);
tempKeySetting[1].iKeyRight = theApp.KeySetting2.iKeyRight;
ConvertScanCode(theApp.KeySetting1.iKeyStart,strText);
SetDlgItemText(hDlg,IDC_START_1,strText);
tempKeySetting[0].iKeyStart = theApp.KeySetting1.iKeyStart;
ConvertScanCode(theApp.KeySetting2.iKeyStart,strText);
SetDlgItemText(hDlg,IDC_START_2,strText);
tempKeySetting[1].iKeyStart = theApp.KeySetting2.iKeyStart;
ConvertScanCode(theApp.KeySetting1.iKeyPause,strText);
SetDlgItemText(hDlg,IDC_PAUSE_1,strText);
tempKeySetting[0].iKeyPause = theApp.KeySetting1.iKeyPause;
ConvertScanCode(theApp.KeySetting2.iKeyPause,strText);
SetDlgItemText(hDlg,IDC_PAUSE_2,strText);
tempKeySetting[1].iKeyPause = theApp.KeySetting2.iKeyPause;
//ConvertScanCode(theApp.KeySetting1.iDifficulty,strText);
snprintf(strText,50,"%d",theApp.KeySetting1.iDifficulty);
SetDlgItemText(hDlg,IDC_DIFFICULT_1,strText);
tempKeySetting[0].iDifficulty = theApp.KeySetting1.iDifficulty;
//ConvertScanCode(theApp.KeySetting2.iDifficulty,strText);
snprintf(strText,50,"%d",theApp.KeySetting2.iDifficulty);
SetDlgItemText(hDlg,IDC_DIFFICULT_2,strText);
tempKeySetting[1].iDifficulty = theApp.KeySetting2.iDifficulty;
return 1;
case MSG_KEYDOWN:
if(wParam == SCANCODE_TAB)
break;
if(wParam == SCANCODE_ENTER)
break;
iCtrlID = GetDlgCtrlID(GetFocusChild(hDlg));
if((iCtrlID != IDOK) && (iCtrlID != IDCANCEL)){
if(((iCtrlID == IDC_DIFFICULT_1) || (iCtrlID == IDC_DIFFICULT_2)) &&((wParam<2)||(wParam>11)))
{
if(iCtrlID==IDC_DIFFICULT_1)
snprintf(strText,50,"%d",tempKeySetting[0].iDifficulty);
else
snprintf(strText,50,"%d",tempKeySetting[1].iDifficulty);
SetDlgItemText(hDlg,iCtrlID,strText);
return 1;
}
if(ConvertScanCode(wParam,strText)){
SaveKeySetting(wParam,iCtrlID,tempKeySetting);
SetDlgItemText(hDlg,iCtrlID,strText);
}
}
return 1;
case MSG_COMMAND:
switch (wParam) {
case IDOK:
if(HaveSameKeySetting(tempKeySetting)){
MessageBox(hDlg,"The Key setting repeat!","Warning",MB_OK);
break;
}
theApp.KeySetting1.iKeyRotate = tempKeySetting[0].iKeyRotate;
theApp.KeySetting2.iKeyRotate = tempKeySetting[1].iKeyRotate;
theApp.KeySetting1.iKeyDown = tempKeySetting[0].iKeyDown;
theApp.KeySetting2.iKeyDown = tempKeySetting[1].iKeyDown;
theApp.KeySetting1.iKeyLeft = tempKeySetting[0].iKeyLeft;
theApp.KeySetting2.iKeyLeft = tempKeySetting[1].iKeyLeft;
theApp.KeySetting1.iKeyRight = tempKeySetting[0].iKeyRight;
theApp.KeySetting2.iKeyRight = tempKeySetting[1].iKeyRight;
theApp.KeySetting1.iKeyStart = tempKeySetting[0].iKeyStart;
theApp.KeySetting2.iKeyStart = tempKeySetting[1].iKeyStart;
theApp.KeySetting1.iKeyPause = tempKeySetting[0].iKeyPause;
theApp.KeySetting2.iKeyPause = tempKeySetting[1].iKeyPause;
theApp.KeySetting1.iDifficulty = tempKeySetting[0].iDifficulty;
theApp.KeySetting2.iDifficulty = tempKeySetting[1].iDifficulty;
EndDialog(hDlg,1);
break;
case IDCANCEL:
EndDialog (hDlg, 0);
break;
}
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
DLGTEMPLATE DlgInputName =
{
WS_BORDER | WS_CAPTION,
WS_EX_IMECOMPOSE,
70, 80, 460, 158,
"输入",
0, 0,
4, NULL,
0
};
CTRLDATA CtrlInputName [] =
{
{
"static",
WS_VISIBLE | SS_RIGHT,
14, 30, 150, 18,
IDC_STATIC,
"请输入您的姓名:",
0
},
{
"edit",
WS_VISIBLE | WS_BORDER | WS_TABSTOP,
180, 30, 200, 22,
IDC_NAMEINPUT,
NULL,
0
},
{
"button",
WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
80, 94, 100, 28,
IDOK,
"确定",
0
},
{
"button",
WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
276, 94, 100, 28,
IDCANCEL,
"取消",
0
}
};
static int
DialogInputNameProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case MSG_INITDIALOG:
return 1;
case MSG_COMMAND:
switch (wParam) {
case IDOK:
GetDlgItemText(hDlg,IDC_NAMEINPUT,theApp.strText,50);
EndDialog(hDlg,1);
break;
case IDCANCEL:
EndDialog (hDlg, 0);
break;
}
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
HMENU createmenu1(void)
{
HMENU hmnu;
MENUITEMINFO mii;
hmnu = CreateMenu();
memset (&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.id = 100;
mii.typedata = (DWORD)"Start";
mii.hsubmenu = createpmenustart();
InsertMenuItem(hmnu, 0, TRUE, &mii);
mii.type = MFT_STRING;
mii.id = 110;
mii.typedata = (DWORD)"Setting";
mii.hsubmenu = createpmenusetting();
InsertMenuItem(hmnu, 1, TRUE, &mii);
mii.type = MFT_STRING;
mii.id = 120;
mii.typedata = (DWORD)"About";
mii.hsubmenu = createpmenuabout();
InsertMenuItem(hmnu, 2, TRUE, &mii);
return hmnu;
}
HMENU createpmenustart(void)
{
HMENU hmnu;
MENUITEMINFO mii;
memset (&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.id = 0;
mii.typedata = (DWORD)"Start";
hmnu = CreatePopupMenu (&mii);
memset (&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING ;
mii.state = 0;
mii.id = ID_NEWONE;
mii.typedata = (DWORD)"Start one player game";
InsertMenuItem(hmnu, 0, TRUE, &mii);
mii.type = MFT_STRING ;
mii.state = 0;
mii.id = ID_NEWTWO;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -