MINI DOOM  ++    2   
 


   MINI DOOM.  C++  .    :    Windows     .  ,       ,         ,       FPS      dt.       Raw Input,     Windows ,      ,     ,    .    ,      ,      .   C++20  WinAPI,  ,  . 18+.





 

MINI DOOM  ++    2   





 



    MINI DOOM.  C++  .       C++  : , , , ,  ,        ,   AddressSanitizer.

     : ,  ,     .  ,      ,   .  12   ,    .




 


  1.      18:  C++  ,       .

  2.      913:   Windows, ,  ,   , .

  3.     1419: , , ,   , .

  4.  -    2025: , , ,  , .

  5. ,       2629: , , , CMake  .

     GitHub: https://github.com/RushSex/MiniDoom.  examples/chNN   ,    examples/ch29/doom.   README      Visual Studio 2026.      ,       ,       .




 II.   



  . ׸      ,  Doom   : , , .        Windows,      ,   ,      ,        .         ,      ,       .

    . ,    Windows,         ,    .     MINI DOOM:      Windows ,    main_win32.cpp        .               .











 9.  



  Windows      .  ,    :  , , ,   ,     Windows   .       ,  Windows ,   ,      .

           Win32 API      .   ,   :       MINI DOOM.




 Windows   


   . Windows  ,      :    ,  ,   ,  .    .       ,         .

      while   wWinMain.       ,       Windows  . Windows     ,   :      .      9.1.








 9.1   : Windows    ,       











 


     9.1.    1280 ? 800   MINI DOOM    .   main_win32.cpp:    ,    Windows,         .








 9.1     








 9.1 ()     



,     ,  9.2.   ,    :   , ,       .








 9.2    MINI DOOM       9.1



   ,     .

 1,  3442   .    , Windows    :       ,  ,   .     WNDCLASSEXW    RegisterClassExW.      wc{}   ,     .  cbSize    :  Windows ,      .

 2,  4453   .  ,       1280 ? 800,        . AdjustWindowRect            .  CreateWindowExW     ,  ShowWindow  .       ,    9.3.








 9.3     ,    ; AdjustWindowRect      



 3,  5559   . GetMessageW ,     ,     msg. TranslateMessage           ,   . DispatchMessageW     .  ,  GetMessageW   .     ,       .

 928   .     . WM_PAINT ,      ,   -  .      BeginPaint  EndPaint. WM_DESTROY ,   ,  PostQuitMessage(0)        ,   .    ,  ,        DefWindowProcW   27.

    W         L  : L"MINI DOOM".        Unicode.      char,    ,     wchar_t.      Windows,   9.2:      Windows     Windows-.








 9.2        Windows



 Windows wchar_t   ,   L"DOOM"    .      UTF-16  Windows       Windows NT.    W-  L-:  ,           .

        2.    long,   Windows  4 ,   Linux  8?  , : Windows-   4.       Linux,  wchar_t  4   long  8.   C++        ,     .















 9.1   Win32,     







 Visual Studio    C++         Windows,     .   main_win32.cpp,      1.2      9.2.








 9.2      



      clang  Windows   9.3.      Unicode,   .








 9.3    Windows:  Unicode   



 Unicode     38.   ,     Windows   : LoadCursorA      LoadCursorW  Unicode.  IDC_ARROW    ,       UNICODE.   W-,  IDC_ARROW  A-    .  -municode  Unicode   ,     wWinMain.  -mwindows     ,   .     ,   file :    Windows   , GUI.

























 


 Windows    ,    .

     GetMessageW   DispatchMessageW  .

     ,   DefWindowProcW.

     ; AdjustWindowRect    .

 WM_DESTROY ? PostQuitMessage ? GetMessageW  0 ?  .

     W-  L"...";   Windows,    wWinMain.

 :      MINI DOOM,    Windows   .   10            .







 9.1. ?    9.4   Windows.   ?     .








 9.4   9.1



 9.2. .     9.5     ,      ,  doom.exe  .  ?








 9.5   9.2








 9.5 ()   9.2



 9.3. .  ,      Esc. :     WM_KEYDOWN,       wp;  Esc  VK_ESCAPE.

 9.4..  ,    WM_PAINT   BeginPaint  EndPaint       0?







 9.1.   .  ,             . :  WS_OVERLAPPEDWINDOW     ;      &  ~.

 9.2.  .    Windows  WM_CLOSE.       MessageBoxW,     .  ,    .

 9.3.  .                SetWindowTextW.     ,     .




 10. 



׸       Windows.  ,    :    ,    ,    .   ,    :      ,       ,  Windows     .

   ,   ,                .             .




  


     , .      : ,       RGB.       0  255,   .      ,   255  ,  255      .     256?,    17  .

      32-  std::uint32_t.     :   ,  ,   .       0x00RRGGBB      ,     .          ,   10.1.








 10.1        



 8  .  <<    : r << 16    16  ,   ; g << 8   .    .  | (  )      ,    ,      .     ,    10.1.








 10.1     32- :    



 1618   .        ,   & 0xFF  ,  :     .   ,   0x00FF7828    255, 120  40.

 22       .     18       .   {:08X}  std::format    ,     :      .











  


   640 ? 400 .    ?   ,      .   :     640 ? 400 = 256 000 ,      ,   .  (x, y)    y ? width + x:  y     x  .     4 ? 3   10.2.








 10.2      



       :   .      ,   :    .  C   (1, 2)    2 ? 4 + 1 = 9.     10.2.








 10.2   4 ? 3      :     



    ,     10.3.     640 ? 400 :     x = 0,   x = width.   .








 10.3      ,  



        13.   ,    :  ,  .    x = width,      width ? 1.   ,  ,  x = width         .       ,       .        ,      .











:  Canvas


          7.      ,     ,     .      Windows:   C++.    10.4.




  .


   .

   ,     (https://www.litres.ru/book/aleksey-primak/mini-doom-sovremennyi-s-cherez-igru-tom-2-okno-v-ad-74670698/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


