Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1. #include<windows.h>
  2. #include "dbsHeader.h"
  3.  
  4. LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  5. {
  6.     if(msg == WM_DESTROY)
  7.     {
  8.         PostQuitMessage(0);
  9.         return 0;
  10.     }
  11.     return DefWindowProc(hwnd, msg, wParam, lParam);
  12. }
  13.  
  14. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
  15. {
  16.     dbs_class oggetto;
  17.     WNDCLASSEX wc;
  18.     memset(&wc, 0x00, sizeof(WNDCLASSEX));
  19.     wc.cbSize        = sizeof(WNDCLASSEX);
  20.     wc.style         = 0;
  21.     wc.lpfnWndProc   = WndProc;
  22.     wc.cbClsExtra    = 0;
  23.     wc.cbWndExtra    = 0;
  24.     wc.hInstance     = hInstance;
  25.     wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  26.     wc.lpszMenuName  = NULL;
  27.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  28.     wc.lpszClassName = "classname";
  29.     if(!RegisterClassEx(&wc))
  30.     {
  31.         MessageBox(NULL, "Registrazione Classe fallita.", "Errore", MB_OK);
  32.         return 0;
  33.     }
  34.     HWND hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, "classname", "Directx Bubble Sort", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, NULL, NULL, hInstance, NULL);
  35.     if(hWnd == NULL)
  36.     {
  37.         MessageBox(NULL, "Creazione Window Fallita.", "Errore",  MB_OK);
  38.         return 0;
  39.     }
  40.     if(FAILED(oggetto.InitD3D(hWnd))) return -1;
  41.     ShowWindow(hWnd, SW_SHOWDEFAULT);
  42.     UpdateWindow(hWnd);
  43.     MSG msg;
  44.     while(TRUE)
  45.     {
  46.         while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  47.         {
  48.             TranslateMessage(&msg);
  49.             DispatchMessage(&msg);
  50.         }
  51.         if(msg.message == WM_QUIT) break;
  52.         oggetto.BubbleSort();
  53.         oggetto.Render();
  54.     }
  55.     oggetto.Cleanup();
  56.     return msg.wParam;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement