?? createwindows.cpp
字號:
#include "header.h"
#include "D3DInit.h"
CD3DInit* g_D3DInit = new CD3DInit();
long FAR PASCAL WindowProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
}
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "createwindows";
RegisterClass(&wc);
hWnd = CreateWindowEx( WS_EX_TOPMOST,
"createwindows",
"window title",
WS_OVERLAPPEDWINDOW,
50,
50,
800,
600,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
{
return FALSE;
}
g_D3DInit->GameInit(hWnd);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while(true)
{
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
g_D3DInit->Render();
}
}
DEL(g_D3DInit);
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -