• 【Visual C++】游戏开发笔记二十六 DirectX 11各组件的介绍&第一个DirectX 11 Demo的创建


    #include<Windows.h>
     
    //函数声明
    LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
     
     
    //****wWinMain函数,程序入口点函数**************************************
    int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine,int cmdShow )
    {
        UNREFERENCED_PARAMETER( prevInstance );
        UNREFERENCED_PARAMETER( cmdLine );
          
        WNDCLASSEX wndClass = { 0 };
        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 =L"DIRECTX11BookWindowClass";
          
        if( !RegisterClassEx( &wndClass ) )
            return -1;
          
        RECT rc = { 0, 0, 640, 480 };
        AdjustWindowRect( &rc,WS_OVERLAPPEDWINDOW, FALSE );
          
        HWND hwnd = CreateWindow( L"DIRECTX11BookWindowClass",L"Blank Win32 Window",
            WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, rc.right - rc.left,
            rc.bottom - rc.top, NULL, NULL,hInstance, NULL );
          
        if( !hwnd )
            return -1;
          
        ShowWindow( hwnd, cmdShow );
          
     
     
        // 初始化
        MSG msg = { 0 };
          
        while( msg.message != WM_QUIT )
        {
            if( PeekMessage( &msg, 0, 0, 0,PM_REMOVE ) )
            {
                TranslateMessage( &msg );
                DispatchMessage( &msg );
            }
            else
            {
                // 进行更新
                // 进行绘图操作
            }
        }
          
        // 收尾工作
          
        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:
                  hDC = BeginPaint( hwnd,&paintStruct );
                  EndPaint( hwnd, &paintStruct);
                  break;
                 
           case WM_DESTROY:
                  PostQuitMessage( 0 );
                  break;
                 
           default:
                  return DefWindowProc( hwnd,message, wParam, lParam );
        }
          
        return 0;
    }
  • 相关阅读:
    第1章 初涉MySQL
    成绩转换
    【JSTL】--附加:c:import,c:url;c:param,c:redirect--drp217
    【JSTL】--JSTL表达式:c:forEach,varstatus/begin end/循环控制标签--drp215
    【JSTL】--JSTL表达式:c:forEach--drp215
    【JSTL】--JSTL表达式:c:set,c:if,c:choose,--drp214
    【JSTL】--c:out演示--drp213
    【JSTL】--测试EL表达式--drp212~
    【JSTL】--读取实体成员变量吗?--drp212
    【JSTL】--测试EL表达式--drp212
  • 原文地址:https://www.cnblogs.com/szmtjs10/p/16084396.html
Copyright © 2020-2023  润新知