int main() { // // Create a new window // g_pHWND = CreateGameWindow(); // // Create a GWEN GDI+ Renderer // Note: we're using the buffered version. // This version draws to a texture and then draws that texture to the window // This prevents all the crazy flickering (test with Gwen::Renderer::GDIPlus to see) // Gwen::Renderer::GDIPlusBuffered* pRenderer = new Gwen::Renderer::GDIPlusBuffered( g_pHWND ); // // Create a GWEN skin // //Gwen::Skin::Simple skin; Gwen::Skin::TexturedBase* skin = new Gwen::Skin::TexturedBase( pRenderer ); skin->Init( "DefaultSkin.png" ); // // Create a Canvas (it's root, on which all other GWEN panels are created) // Gwen::Controls::Canvas* pCanvas = new Gwen::Controls::Canvas( skin ); pCanvas->SetSize( 998, 650 - 24 ); pCanvas->SetDrawBackground( true ); pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); // // Create our unittest control (which is a Window with controls in it) // UnitTest* pUnit = new UnitTest( pCanvas ); pUnit->SetPos( 10, 10 ); // // Create a Windows Control helper // (Processes Windows MSG's and fires input at GWEN) // Gwen::Input::Windows GwenInput; GwenInput.Initialize( pCanvas ); // // Begin the main game loop // MSG msg; while( true ) { // Skip out if the window is closed if ( !IsWindowVisible( g_pHWND ) ) break; // If we have a message from windows.. if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { // .. give it to the input handler to process GwenInput.ProcessMessage( msg ); // if it's QUIT then quit.. if ( msg.message == WM_QUIT ) break; if ( msg.message == WM_PAINT ) { // This doesn't actually draw it, it just marks it // so it will redraw when next checked (NeedsRedraw) pCanvas->Redraw(); } // Handle the regular window stuff.. TranslateMessage(&msg); DispatchMessage(&msg); } // If GWEN's Canvas needs a redraw then redraw it // // In your game you would probably just draw it // every frame. But we have the option of only // drawing it when it needs it too. // if ( pCanvas->NeedsRedraw() ) { pCanvas->RenderCanvas(); } } delete pCanvas; delete skin; delete pRenderer; }