mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Merge remote-tracking branch 'Areloch/SplashScreenFix' into development
This commit is contained in:
commit
5a1f6967ce
14 changed files with 106 additions and 9 deletions
|
|
@ -1589,6 +1589,13 @@ DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/s
|
||||||
return Platform::displaySplashWindow(path);
|
return Platform::displaySplashWindow(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineFunction( closeSplashWindow, void, (),,
|
||||||
|
"Close our startup splash window.\n\n"
|
||||||
|
"@note This is currently only implemented on Windows.\n\n"
|
||||||
|
"@ingroup Platform" )
|
||||||
|
{
|
||||||
|
Platform::closeSplashWindow();
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DefineEngineFunction( getWebDeployment, bool, (),,
|
DefineEngineFunction( getWebDeployment, bool, (),,
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
||||||
mMiddleMouseLast(false),
|
mMiddleMouseLast(false),
|
||||||
mRightMouseLast(false),
|
mRightMouseLast(false),
|
||||||
mPlatformWindow(NULL),
|
mPlatformWindow(NULL),
|
||||||
mLastRenderMs(0)
|
mLastRenderMs(0),
|
||||||
|
mDisplayWindow(true)
|
||||||
{
|
{
|
||||||
setBounds(0, 0, 640, 480);
|
setBounds(0, 0, 640, 480);
|
||||||
mAwake = true;
|
mAwake = true;
|
||||||
|
|
@ -176,6 +177,8 @@ void GuiCanvas::initPersistFields()
|
||||||
|
|
||||||
addGroup("Canvas Rendering");
|
addGroup("Canvas Rendering");
|
||||||
addProtectedField( "numFences", TypeS32, Offset( mNumFences, GuiCanvas ), &setProtectedNumFences, &defaultProtectedGetFn, "The number of GFX fences to use." );
|
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");
|
endGroup("Canvas Rendering");
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
@ -252,6 +255,19 @@ bool GuiCanvas::onAdd()
|
||||||
// Make sure we're able to render.
|
// Make sure we're able to render.
|
||||||
newDevice->setAllowRender( true );
|
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.
|
// Propagate add to parents.
|
||||||
// CodeReview - if GuiCanvas fails to add for whatever reason, what happens to
|
// CodeReview - if GuiCanvas fails to add for whatever reason, what happens to
|
||||||
// all the event registration above?
|
// all the event registration above?
|
||||||
|
|
@ -2683,3 +2699,23 @@ ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 8,
|
||||||
// Store the new mode into a pref.
|
// Store the new mode into a pref.
|
||||||
Con::setVariable( "$pref::Video::mode", vm.toString() );
|
Con::setVariable( "$pref::Video::mode", vm.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConsoleMethod( GuiCanvas, showWindow, void, 2, 2, "" )
|
||||||
|
{
|
||||||
|
if (!object->getPlatformWindow())
|
||||||
|
return;
|
||||||
|
|
||||||
|
object->getPlatformWindow()->show();
|
||||||
|
WindowManager->setDisplayWindow(true);
|
||||||
|
object->getPlatformWindow()->setDisplayWindow(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" )
|
||||||
|
{
|
||||||
|
if (!object->getPlatformWindow())
|
||||||
|
return;
|
||||||
|
|
||||||
|
object->getPlatformWindow()->hide();
|
||||||
|
WindowManager->setDisplayWindow(false);
|
||||||
|
object->getPlatformWindow()->setDisplayWindow(false);
|
||||||
|
}
|
||||||
|
|
@ -108,6 +108,8 @@ protected:
|
||||||
bool mClampTorqueCursor;
|
bool mClampTorqueCursor;
|
||||||
bool mAlwaysHandleMouseButtons;
|
bool mAlwaysHandleMouseButtons;
|
||||||
|
|
||||||
|
bool mDisplayWindow;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Mouse Input
|
/// @name Mouse Input
|
||||||
|
|
|
||||||
|
|
@ -338,6 +338,9 @@ namespace Platform
|
||||||
// display Splash Window
|
// display Splash Window
|
||||||
bool displaySplashWindow( String path );
|
bool displaySplashWindow( String path );
|
||||||
|
|
||||||
|
// close Splash Window
|
||||||
|
bool closeSplashWindow();
|
||||||
|
|
||||||
void openFolder( const char* path );
|
void openFolder( const char* path );
|
||||||
|
|
||||||
// Open file at the OS level, according to registered file-types.
|
// Open file at the OS level, according to registered file-types.
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,10 @@ protected:
|
||||||
/// Offscreen Render
|
/// Offscreen Render
|
||||||
bool mOffscreenRender;
|
bool mOffscreenRender;
|
||||||
|
|
||||||
|
/// This is set as part of the canvas being shown, and flags that the windows should render as normal from now on.
|
||||||
|
// Basically a flag that lets the window manager know that we've handled the splash screen, and to operate as normal.
|
||||||
|
bool mDisplayWindow;
|
||||||
|
|
||||||
/// Protected constructor so that the win
|
/// Protected constructor so that the win
|
||||||
PlatformWindow()
|
PlatformWindow()
|
||||||
{
|
{
|
||||||
|
|
@ -104,6 +108,7 @@ protected:
|
||||||
mSuppressReset = false;
|
mSuppressReset = false;
|
||||||
|
|
||||||
mOffscreenRender = false;
|
mOffscreenRender = false;
|
||||||
|
mDisplayWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -180,6 +185,8 @@ public:
|
||||||
/// This is called to poll the window as to it's idle state.
|
/// This is called to poll the window as to it's idle state.
|
||||||
virtual bool getOffscreenRender() { return mOffscreenRender; };
|
virtual bool getOffscreenRender() { return mOffscreenRender; };
|
||||||
|
|
||||||
|
/// Set whether this window is should display as normal
|
||||||
|
virtual void setDisplayWindow(bool val ) { mDisplayWindow = val; };
|
||||||
|
|
||||||
/// Set Focused State (Foreground)
|
/// Set Focused State (Foreground)
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,9 @@ public:
|
||||||
/// This method removes the curtain window.
|
/// This method removes the curtain window.
|
||||||
virtual void raiseCurtain()=0;
|
virtual void raiseCurtain()=0;
|
||||||
|
|
||||||
|
/// This method indicates to created windows to show as normal.
|
||||||
|
virtual void setDisplayWindow(bool set){}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Process command line arguments from StandardMainLoop. This is done to
|
/// Process command line arguments from StandardMainLoop. This is done to
|
||||||
/// allow web plugin functionality, where we are passed platform-specific
|
/// allow web plugin functionality, where we are passed platform-specific
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,13 @@ void CloseSplashWindow(HINSTANCE hinst)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Platform::closeSplashWindow()
|
||||||
|
{
|
||||||
|
CloseSplashWindow(GetModuleHandle(NULL));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Platform::displaySplashWindow( String path )
|
bool Platform::displaySplashWindow( String path )
|
||||||
{
|
{
|
||||||
if(path.isEmpty())
|
if(path.isEmpty())
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,9 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
||||||
{
|
{
|
||||||
SetWindowLong( getHWND(), GWL_STYLE, WS_POPUP);
|
SetWindowLong( getHWND(), GWL_STYLE, WS_POPUP);
|
||||||
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
ShowWindow(getHWND(), SW_SHOWNORMAL);
|
|
||||||
|
if(mDisplayWindow)
|
||||||
|
ShowWindow(getHWND(), SW_SHOWNORMAL);
|
||||||
|
|
||||||
// Clear the menu bar from the window for full screen
|
// Clear the menu bar from the window for full screen
|
||||||
HMENU menu = GetMenu(getHWND());
|
HMENU menu = GetMenu(getHWND());
|
||||||
|
|
@ -216,7 +218,9 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
||||||
// We have to force Win32 to update the window frame and make the window
|
// We have to force Win32 to update the window frame and make the window
|
||||||
// visible and no longer topmost - this code might be possible to simplify.
|
// visible and no longer topmost - this code might be possible to simplify.
|
||||||
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
ShowWindow( getHWND(), SW_SHOWNORMAL);
|
|
||||||
|
if(mDisplayWindow)
|
||||||
|
ShowWindow( getHWND(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
mFullscreen = false;
|
mFullscreen = false;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ Win32WindowManager::Win32WindowManager()
|
||||||
|
|
||||||
mOffscreenRender = false;
|
mOffscreenRender = false;
|
||||||
|
|
||||||
|
mDisplayWindow = false;
|
||||||
|
|
||||||
buildMonitorsList();
|
buildMonitorsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,11 +265,13 @@ PlatformWindow *Win32WindowManager::createWindow(GFXDevice *device, const GFXVid
|
||||||
|
|
||||||
// If we're not rendering offscreen, make sure our window is shown and drawn to.
|
// If we're not rendering offscreen, make sure our window is shown and drawn to.
|
||||||
|
|
||||||
if (!mOffscreenRender)
|
w32w->setDisplayWindow(mDisplayWindow);
|
||||||
ShowWindow( w32w->mWindowHandle, SW_SHOWDEFAULT );
|
|
||||||
|
|
||||||
// Close any splash screen we created
|
if (!mOffscreenRender && mDisplayWindow)
|
||||||
CloseSplashWindow(winState.appInstance);
|
{
|
||||||
|
ShowWindow( w32w->mWindowHandle, SW_SHOWDEFAULT );
|
||||||
|
CloseSplashWindow(winState.appInstance);
|
||||||
|
}
|
||||||
|
|
||||||
// Bind the window to the specified device.
|
// Bind the window to the specified device.
|
||||||
if(device)
|
if(device)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ class Win32WindowManager : public PlatformWindowManager
|
||||||
// is intended for offscreen rendering
|
// is intended for offscreen rendering
|
||||||
bool mOffscreenRender;
|
bool mOffscreenRender;
|
||||||
|
|
||||||
|
/// This is set as part of the canvas being shown, and flags that the windows should render as normal from now on.
|
||||||
|
// Basically a flag that lets the window manager know that we've handled the splash screen, and to operate as normal.
|
||||||
|
bool mDisplayWindow;
|
||||||
|
|
||||||
/// Internal structure used when enumerating monitors
|
/// Internal structure used when enumerating monitors
|
||||||
struct MonitorInfo {
|
struct MonitorInfo {
|
||||||
HMONITOR monitorHandle;
|
HMONITOR monitorHandle;
|
||||||
|
|
@ -117,6 +121,8 @@ public:
|
||||||
|
|
||||||
virtual void lowerCurtain();
|
virtual void lowerCurtain();
|
||||||
virtual void raiseCurtain();
|
virtual void raiseCurtain();
|
||||||
|
|
||||||
|
virtual void setDisplayWindow(bool set) { mDisplayWindow = set; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -38,7 +38,10 @@ function createCanvas(%windowTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the Canvas
|
// Create the Canvas
|
||||||
%foo = new GuiCanvas(Canvas);
|
%foo = new GuiCanvas(Canvas)
|
||||||
|
{
|
||||||
|
displayWindow = false;
|
||||||
|
};
|
||||||
|
|
||||||
// Set the window title
|
// Set the window title
|
||||||
if (isObject(Canvas))
|
if (isObject(Canvas))
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@ function loadStartup()
|
||||||
// The index of the current splash screen
|
// The index of the current splash screen
|
||||||
$StartupIdx = 0;
|
$StartupIdx = 0;
|
||||||
|
|
||||||
|
// As we know at this point that the initial load is complete,
|
||||||
|
// we can hide any splash screen we have, and show the canvas.
|
||||||
|
// This keeps things looking nice, instead of having a blank window
|
||||||
|
closeSplashWindow();
|
||||||
|
Canvas.showWindow();
|
||||||
|
|
||||||
// A list of the splash screens and logos
|
// A list of the splash screens and logos
|
||||||
// to cycle through. Note that they have to
|
// to cycle through. Note that they have to
|
||||||
// be in consecutive numerical order
|
// be in consecutive numerical order
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ function createCanvas(%windowTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the Canvas
|
// Create the Canvas
|
||||||
%foo = new GuiCanvas(Canvas);
|
%foo = new GuiCanvas(Canvas)
|
||||||
|
{
|
||||||
|
displayWindow = false;
|
||||||
|
};
|
||||||
|
|
||||||
// Set the window title
|
// Set the window title
|
||||||
if (isObject(Canvas))
|
if (isObject(Canvas))
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@ function loadStartup()
|
||||||
// The index of the current splash screen
|
// The index of the current splash screen
|
||||||
$StartupIdx = 0;
|
$StartupIdx = 0;
|
||||||
|
|
||||||
|
// As we know at this point that the initial load is complete,
|
||||||
|
// we can hide any splash screen we have, and show the canvas.
|
||||||
|
// This keeps things looking nice, instead of having a blank window
|
||||||
|
closeSplashWindow();
|
||||||
|
Canvas.showWindow();
|
||||||
|
|
||||||
// A list of the splash screens and logos
|
// A list of the splash screens and logos
|
||||||
// to cycle through. Note that they have to
|
// to cycle through. Note that they have to
|
||||||
// be in consecutive numerical order
|
// be in consecutive numerical order
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue