Window SDK 入门
2015-06-24 00:50
435 查看
#include<Windows.h> #include<conio.h> #include<memory> #include"GameSpriteDemo.h" #include"TriangleDemo.h" #include"D3DTextDemo.h" /* * This is the beginning of the main function * * Author: ROTBLATT * Date: 2015-05-31 * */ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine, int cmdShow) { UNREFERENCED_PARAMETER(prevInstance); UNREFERENCED_PARAMETER(cmdLine); WNDCLASSEX wndClass = { 0 }; //ZeroMemory(&wndClass, sizeof(wndClass)); wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.style = CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = WndProc; wndClass.hInstance = hInstance; wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.lpszMenuName = NULL; wndClass.lpszClassName = "DX11BookWindowClass"; if (!RegisterClassEx(&wndClass)) return -1; RECT rc = { 0, 0, 1024, 768 }; AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE); HWND hwnd = CreateWindow("DX11BookWindowClass", "DirectX 11 Demo", WS_OVERLAPPEDWINDOW | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL); if (!hwnd) return -1; ShowWindow(hwnd, cmdShow); //GameSpriteDemo demo; //TriangleDemo demo; D3DTextDemo demo; bool result = demo.Initialize(hInstance, hwnd); if (result == false) return -1; MSG msg = { 0 }; while (msg.message != WM_QUIT) { if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } //Update and Draw demo.Update(0.0f); demo.Render(); } demo.Shutdown(); return static_cast<int>(msg.wParam); } LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT paintStruct; HDC hDC; switch (message) { case WM_PAINT: //_cprintf(""); hDC = BeginPaint(hwnd, &paintStruct); EndPaint(hwnd, &paintStruct); break; case WM_SIZE: //MessageBox(NULL, "Windows Changing", "Prompt", MB_OK); //RECT rect; //GetClientRect(hwnd, &rect); //ValidateRect(hwnd,&rect); break; case WM_LBUTTONDOWN: MessageBox(hwnd, "LBT Clicked", "PROMPT", MB_OK); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd,message,wParam,lParam); } return 0; }
相关文章推荐
- Leetcode#7 Reverse Integer !!!Update (2014-11-10)之后的版本!!!
- expdp时遇到ORA-31693&ORA-02354&ORA-01466
- anjularjs
- leetcode 35 -- Search Insert Position
- 读《怪诞行为学》感
- bcompare3+keygen
- 用自己制作的设备得到的3D自画像
- bcompare3+keygen
- 3S比赛预定
- UVa - 1611 - Crane
- UVa - 1611 - Crane
- eclipse debug不起作用了
- 打开网页不显示图片和视频
- 【莫比乌斯反演】BZOJ1101 [POI2007]zap
- 分布式系统设计理念
- leetcode 10 -- Regular Expression Matching
- 获取文件夹下得所有文件,并按文件夹先,文件后的顺序排
- LeetCode——Happy Number
- IOS 开发注意的问题
- volley源码解析(七)--最终目的之Response<T>