实现 WndProc 主窗口消息处理逻辑 完成函数4
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
- [x] `_tWinMain` - `src/source/Tetris.cpp`
|
- [x] `_tWinMain` - `src/source/Tetris.cpp`
|
||||||
- [x] `MyRegisterClass` - `src/source/Tetris.cpp`
|
- [x] `MyRegisterClass` - `src/source/Tetris.cpp`
|
||||||
- [x] `InitInstance` - `src/source/Tetris.cpp`
|
- [x] `InitInstance` - `src/source/Tetris.cpp`
|
||||||
- [ ] `WndProc` - `src/source/Tetris.cpp`
|
- [x] `WndProc` - `src/source/Tetris.cpp`
|
||||||
- [ ] `About` - `src/source/Tetris.cpp`
|
- [ ] `About` - `src/source/Tetris.cpp`
|
||||||
|
|
||||||
## 第二阶段:游戏区域与状态初始化
|
## 第二阶段:游戏区域与状态初始化
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
+35
-1
@@ -104,7 +104,41 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
|||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// TODO(作业4): 补全主窗口消息处理函数。
|
// TODO(作业4): 补全主窗口消息处理函数。
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
int wmId = LOWORD(wParam);
|
||||||
|
|
||||||
|
switch (wmId)
|
||||||
|
{
|
||||||
|
case IDM_ABOUT:
|
||||||
|
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||||
|
break;
|
||||||
|
case IDM_EXIT:
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_PAINT:
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc = BeginPaint(hWnd, &ps);
|
||||||
|
TDrawScreen(hdc, hWnd);
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|||||||
Reference in New Issue
Block a user