فهرست منبع

Fixed the pure virtual function to be an empty one, which should resolve the linux build failure.

Also tweaked the loading methodology to have the canvas by default assume it should force the window display as soon as it can. You can set the canvas to not do that when it's created via the new displayWindow variable.

This way, old templates and projects should work as normal without changes, while the new templates are built to take advantage of the nicer splash screen arrangement.
Areloch 11 سال پیش
والد
کامیت
0878f005c0

+ 19 - 1
Engine/source/gui/core/guiCanvas.cpp

@@ -121,7 +121,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
                         mMiddleMouseLast(false),
                         mRightMouseLast(false),
                         mPlatformWindow(NULL),
-                        mLastRenderMs(0)
+                        mLastRenderMs(0),
+                        mDisplayWindow(true)
 {
    setBounds(0, 0, 640, 480);
    mAwake = true;
@@ -176,6 +177,8 @@ void GuiCanvas::initPersistFields()
 
    addGroup("Canvas Rendering");
    addProtectedField( "numFences", TypeS32, Offset( mNumFences, GuiCanvas ), &setProtectedNumFences, &defaultProtectedGetFn, "The number of GFX fences to use." );
+
+   addField("displayWindow", TypeBool, Offset(mDisplayWindow, GuiCanvas), "Controls if the canvas window is rendered or not." );
    endGroup("Canvas Rendering");
 
    Parent::initPersistFields();
@@ -252,6 +255,19 @@ bool GuiCanvas::onAdd()
    // Make sure we're able to render.
    newDevice->setAllowRender( true );
 
+   if(mDisplayWindow)
+   {
+      getPlatformWindow()->show();
+      WindowManager->setDisplayWindow(true);
+      getPlatformWindow()->setDisplayWindow(true);
+   }
+   else
+   {
+      getPlatformWindow()->hide();
+      WindowManager->setDisplayWindow(false);
+      getPlatformWindow()->setDisplayWindow(false);
+   }
+
    // Propagate add to parents.
    // CodeReview - if GuiCanvas fails to add for whatever reason, what happens to
    // all the event registration above?
@@ -2700,4 +2716,6 @@ ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" )
       return;
 
    object->getPlatformWindow()->hide();
+	WindowManager->setDisplayWindow(false);
+   object->getPlatformWindow()->setDisplayWindow(false);
 }

+ 2 - 0
Engine/source/gui/core/guiCanvas.h

@@ -108,6 +108,8 @@ protected:
    bool        mClampTorqueCursor;
    bool        mAlwaysHandleMouseButtons;
 
+   bool        mDisplayWindow;
+
    /// @}
 
    /// @name Mouse Input

+ 1 - 1
Engine/source/windowManager/platformWindowMgr.h

@@ -134,7 +134,7 @@ public:
    virtual void raiseCurtain()=0;
 
    /// This method indicates to created windows to show as normal.
-   virtual void setDisplayWindow(bool set)=0;
+   virtual void setDisplayWindow(bool set){}
 
 private:
    /// Process command line arguments from StandardMainLoop. This is done to

+ 3 - 0
Engine/source/windowManager/win32/win32WindowMgr.cpp

@@ -268,7 +268,10 @@ PlatformWindow *Win32WindowManager::createWindow(GFXDevice *device, const GFXVid
    w32w->setDisplayWindow(mDisplayWindow);
 
    if (!mOffscreenRender && mDisplayWindow)
+   {
       ShowWindow( w32w->mWindowHandle, SW_SHOWDEFAULT );
+      CloseSplashWindow(winState.appInstance);
+   }
 
    // Bind the window to the specified device.
    if(device)

+ 4 - 1
Templates/Empty/game/main.cs

@@ -38,7 +38,10 @@ function createCanvas(%windowTitle)
    }
 
    // Create the Canvas
-   %foo = new GuiCanvas(Canvas);
+   %foo = new GuiCanvas(Canvas)
+   {
+      displayWindow = false;
+   };
    
    // Set the window title
    if (isObject(Canvas))

+ 4 - 1
Templates/Full/game/main.cs

@@ -38,7 +38,10 @@ function createCanvas(%windowTitle)
    }
 
    // Create the Canvas
-   %foo = new GuiCanvas(Canvas);
+   %foo = new GuiCanvas(Canvas)
+   {
+      displayWindow = false;
+   };
    
    // Set the window title
    if (isObject(Canvas))