Skip to content

Commit

Permalink
waits at end
Browse files Browse the repository at this point in the history
  • Loading branch information
asd committed Aug 17, 2020
1 parent 70ae311 commit c57a775
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions DirectX 9.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//#define USETHREADS //spawn a second renderer thread and use busy message reading for input
#define MODEZERO //comment out for human benchmark mode
//#define MODEZERO //comment out for human benchmark mode, uncomment for black and white
//#define FPSLIMIT 4000 //comment out for uncapped FPS

//set these for different viewport resolution, for example
Expand Down Expand Up @@ -163,7 +163,8 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

int main() //for console purposes.
{
return WinMain(GetModuleHandle(NULL), NULL, NULL, SW_SHOWNORMAL);
int ret = WinMain(GetModuleHandle(NULL), NULL, NULL, SW_SHOWNORMAL);
return ret;
}

inline void renderFunc(LPDIRECT3DDEVICE9 d3ddev) {
Expand Down Expand Up @@ -283,9 +284,21 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
#ifdef USETHREADS
renderThread.join(); //var 'stop' ends the thread
#endif
d3ddev->Release(); //release d3d
d3d->Release();

d3ddev->Release(); //release d3d
d3d->Release();

free(raw_buf);

DestroyWindow(hWnd);
PostQuitMessage(0);

ShowCursor(true);

#ifndef MODEZERO
std::cout << "\nPress Enter to Continue\n";
getchar();
#endif

return 0; //all done
}

0 comments on commit c57a775

Please sign in to comment.