📄 windowstuff.c
字号:
//Window handler
long WINAPI WindowMessageHandler (HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam)
{
//Close window
if (wMessage == WM_CLOSE) Done = -1;
#include "bombermessages.c"
//Other messages
return DefWindowProc (hWnd, wMessage, wParam, lParam);
}
//Registers a new window class and creates an empty window.
void InitWindow ()
{
//For initializing the window
WNDCLASS wndclass;
RECT ClientArea;
//Register window class, as standard as can be
wndclass.style = 0;
wndclass.lpfnWndProc = (WNDPROC)WindowMessageHandler;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = InstanceHandle;
wndclass.hIcon = LoadIcon(InstanceHandle, MAKEINTRESOURCE (IDI_MAINICON));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = (LPSTR)"GAME";
RegisterClass (&wndclass);
//Resize window so it can accomodate a 256x256 bitmap
ClientArea.left = 0;
ClientArea.top = 0;
ClientArea.right = 272;
ClientArea.bottom = 272;
AdjustWindowRect (&ClientArea, WS_CAPTION | WS_SYSMENU, FALSE);
ClientArea.bottom -= ClientArea.top;
ClientArea.right -= ClientArea.left;
//Create empty window
WindowHandle =
CreateWindow ((LPSTR)"GAME", //Class name
(LPSTR)"Bomberman", //Window name
WS_CAPTION | WS_SYSMENU, //Window type
CW_USEDEFAULT, 0, //Don't specify location
ClientArea.right, //Specify size
ClientArea.bottom,
NULL, //No parent window
NULL, //No menu
InstanceHandle, //It belongs to this program
NULL); //No other data
//Display the window
ShowWindow (WindowHandle, SW_SHOWNORMAL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -