From 0878f005c05baf50696bf1dbc67fb7bad2b775a4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 4 Aug 2014 21:28:36 -0500 Subject: [PATCH] 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. --- Engine/source/gui/core/guiCanvas.cpp | 20 ++++++++++++++++++- Engine/source/gui/core/guiCanvas.h | 2 ++ .../source/windowManager/platformWindowMgr.h | 2 +- .../windowManager/win32/win32WindowMgr.cpp | 3 +++ Templates/Empty/game/main.cs | 5 ++++- Templates/Full/game/main.cs | 5 ++++- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index f5a84e77e..1d5166fce 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/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); } \ No newline at end of file diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index 04af6d692..9d3ed8b10 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -108,6 +108,8 @@ protected: bool mClampTorqueCursor; bool mAlwaysHandleMouseButtons; + bool mDisplayWindow; + /// @} /// @name Mouse Input diff --git a/Engine/source/windowManager/platformWindowMgr.h b/Engine/source/windowManager/platformWindowMgr.h index f2089f51d..41fcd8c9d 100644 --- a/Engine/source/windowManager/platformWindowMgr.h +++ b/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 diff --git a/Engine/source/windowManager/win32/win32WindowMgr.cpp b/Engine/source/windowManager/win32/win32WindowMgr.cpp index 266049b6b..d9e0cc22d 100644 --- a/Engine/source/windowManager/win32/win32WindowMgr.cpp +++ b/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) diff --git a/Templates/Empty/game/main.cs b/Templates/Empty/game/main.cs index bd1333e6a..512c0cc4e 100644 --- a/Templates/Empty/game/main.cs +++ b/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)) diff --git a/Templates/Full/game/main.cs b/Templates/Full/game/main.cs index 11c7348d0..d8fc36dbc 100644 --- a/Templates/Full/game/main.cs +++ b/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))