> }
> ShowWindow(hWnd, SW_SHOW);
> UpdateWindow(hWnd);
> while (lpMsg.message != WM_QUIT) {
> if(PeekMessage(&lpMsg, 0, 0, 0, PM_REMOVE)) {
> TranslateMessage(&lpMsg);
> DispatchMessage(&lpMsg);
> } else if(g_bActive) {
> MainLoop();
> }
> }
> return lpMsg.wParam;
>}
The longest function in our application, WinMain(). As usual, we setup our window class, create our window, show and update it, and go into the message loop. The loop is different from usual because we dont want the processing of our game to interfere with the processing of messages. We use our g_bActive flag to see if its safe to call our game loop, which involves blitting things onto the screen, and at the end of it all we finally return lpMsg.wParam (I'm honestly not sure why, but thats how it's done in every other Win32 app, so oh well).
Pretty simple, huh? 135 lines of code and we're already blitting stuff to the screen. Feel free to explore these classes further, and experiment with things like color keying, loading surfaces from bitmaps, ect. This is a very cool shortcut to using DDraw. It makes things easy without sacrificing control (you can always go back and edit the classes if you want) or performance. One thing to note is that on my computer if I don't draw anything onto the screen using this framework, the application will lock up (which is why I've included text output here). This shouldn't be much of an issue, seeing as how your game will more than likely be blitting things onto the screen (unless there's some new art style which I'm not aware of).
Have fun!