diff --git a/report/images/.gitkeep b/report/images/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/report/images/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/report/images/Part1/MyRegisterClass.png b/report/images/Part1/MyRegisterClass.png new file mode 100644 index 0000000..8e927c7 Binary files /dev/null and b/report/images/Part1/MyRegisterClass.png differ diff --git a/report/images/Part1/_tWinMainAfter.png b/report/images/Part1/_tWinMainAfter.png new file mode 100644 index 0000000..0911c32 Binary files /dev/null and b/report/images/Part1/_tWinMainAfter.png differ diff --git a/report/images/Part1/_tWinMainBefore.png b/report/images/Part1/_tWinMainBefore.png new file mode 100644 index 0000000..c00ef57 Binary files /dev/null and b/report/images/Part1/_tWinMainBefore.png differ diff --git a/src/source/Tetris.cpp b/src/source/Tetris.cpp index 538f195..eb6c088 100644 --- a/src/source/Tetris.cpp +++ b/src/source/Tetris.cpp @@ -22,7 +22,28 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO(作业1): 补全 Win32 程序入口函数。 - return 0; + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_TETRIS, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TETRIS)); + MSG msg; + + while (GetMessage(&msg, nullptr, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int)msg.wParam; } ATOM MyRegisterClass(HINSTANCE hInstance)