Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<windows.h>
- #include "dbsHeader.h"
- LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- if(msg == WM_DESTROY)
- {
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
- }
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
- {
- dbs_class oggetto;
- WNDCLASSEX wc;
- memset(&wc, 0x00, sizeof(WNDCLASSEX));
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.lpszClassName = "classname";
- if(!RegisterClassEx(&wc))
- {
- MessageBox(NULL, "Registrazione Classe fallita.", "Errore", MB_OK);
- return 0;
- }
- HWND hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, "classname", "Directx Bubble Sort", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, NULL, NULL, hInstance, NULL);
- if(hWnd == NULL)
- {
- MessageBox(NULL, "Creazione Window Fallita.", "Errore", MB_OK);
- return 0;
- }
- if(FAILED(oggetto.InitD3D(hWnd))) return -1;
- ShowWindow(hWnd, SW_SHOWDEFAULT);
- UpdateWindow(hWnd);
- MSG msg;
- while(TRUE)
- {
- while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- if(msg.message == WM_QUIT) break;
- oggetto.BubbleSort();
- oggetto.Render();
- }
- oggetto.Cleanup();
- return msg.wParam;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement