PlatformWindow *Win32WindowManager::createWindow(GFXDevice *device, const GFXVideoMode &mode)
{
   // Do the allocation.
   Win32Window *w32w = new Win32Window();
   w32w->setOffscreenRender(mOffscreenRender);
   w32w->mWindowId = getNextId();
   w32w->mOwningManager = this;

   // Link into our list of windows.
   linkWindow(w32w);

   DWORD	dwExStyle;
   DWORD dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
   dwStyle       |= WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_CAPTION; 
   dwExStyle     = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;

   // If we're parented, we want a different set of window styles.
   if(mParentWindow)
      dwStyle = WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILDWINDOW;

   if (mOffscreenRender)
   {
      dwStyle = WS_OVERLAPPEDWINDOW;
      dwExStyle = 0;
   }

   // Create the window handle
   w32w->mWindowHandle = CreateWindowEx(
      dwExStyle,
      Win32Window::getWindowClassName(),           //class name
      String( getEngineProductString() ).utf16(),  //window title
      dwStyle,                                     //style - need clip siblings/children for opengl
      0,
      0,
      0,
      0,
      mParentWindow,                     //parent window
      NULL,                              //menu? No.
      NULL,                              //the hInstance
      NULL );                            //no funky params

   // Note the style we created with so we can switch back to it when we're
   // done with full-screen mode.
   w32w->mWindowedWindowStyle = dwStyle;

   // Set the video mode on the window
   w32w->setVideoMode(mode);

   // Associate our window struct with the HWND.
   SetWindowLongPtrW(w32w->mWindowHandle, GWLP_USERDATA, (LONG)w32w);

   // Do some error checking.
   AssertFatal(w32w->mWindowHandle != NULL, "Win32WindowManager::createWindow - Could not create window!");
   if(w32w->mWindowHandle == NULL)
   {
      Con::errorf("Win32WindowManager::createWindow - Could not create window!");
      delete w32w;
      return NULL;
   }

   // If we're not rendering offscreen, make sure our window is shown and drawn to.

   if (!mOffscreenRender)
      ShowWindow( w32w->mWindowHandle, SW_SHOWDEFAULT );

   // Close any splash screen we created
   CloseSplashWindow(winState.appInstance);

   // Bind the window to the specified device.
   if(device)
   {
      w32w->mDevice = device;
      w32w->mTarget = device->allocWindowTarget(w32w);
      AssertISV(w32w->mTarget, 
         "Win32WindowManager::createWindow - failed to get a window target back from the device.");
   }
   else
   {
      Con::warnf("Win32WindowManager::createWindow - created a window with no device!");
   }

   // Update it if needed.
   UpdateWindow( w32w->mWindowHandle );

   return w32w;
}
Ejemplo n.º 2
0
bool Platform::closeSplashWindow()
{
    CloseSplashWindow(GetModuleHandle(NULL));

    return true;
}