mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge branch 'splashAndWindowIcons' of https://github.com/Areloch/Torque3D into development
This commit is contained in:
commit
713c93d328
|
|
@ -2141,13 +2141,18 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),,
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/splash.bmp"),
|
DefineEngineFunction( displaySplashWindow, bool, (const char* path), (""),
|
||||||
"Display a startup splash window suitable for showing while the engine still starts up.\n\n"
|
"Display a startup splash window suitable for showing while the engine still starts up.\n\n"
|
||||||
"@note This is currently only implemented on Windows.\n\n"
|
"@note This is currently only implemented on Windows.\n\n"
|
||||||
"@param path relative path to splash screen image to display.\n"
|
"@param path relative path to splash screen image to display.\n"
|
||||||
"@return True if the splash window could be successfully initialized.\n\n"
|
"@return True if the splash window could be successfully initialized.\n\n"
|
||||||
"@ingroup Platform" )
|
"@ingroup Platform" )
|
||||||
{
|
{
|
||||||
|
if (path == "")
|
||||||
|
{
|
||||||
|
path = Con::getVariable("$Core::splashWindowImage");
|
||||||
|
}
|
||||||
|
|
||||||
return Platform::displaySplashWindow(path);
|
return Platform::displaySplashWindow(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "gfx/gfxDevice.h"
|
#include "gfx/gfxDevice.h"
|
||||||
#include "core/util/journal/process.h"
|
#include "core/util/journal/process.h"
|
||||||
#include "core/strings/unicode.h"
|
#include "core/strings/unicode.h"
|
||||||
|
#include "gfx/bitmap/gBitmap.h"
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
|
@ -165,6 +166,51 @@ PlatformWindow *PlatformWindowManagerSDL::createWindow(GFXDevice *device, const
|
||||||
window->mOwningManager = this;
|
window->mOwningManager = this;
|
||||||
mWindowMap[ window->mWindowId ] = window;
|
mWindowMap[ window->mWindowId ] = window;
|
||||||
|
|
||||||
|
//Now, fetch our window icon, if any
|
||||||
|
Torque::Path iconPath = Torque::Path(Con::getVariable( "$Core::windowIcon" ));
|
||||||
|
Resource<GBitmap> bmp = GBitmap::load(iconPath);
|
||||||
|
if (bmp != NULL)
|
||||||
|
{
|
||||||
|
U32 pitch;
|
||||||
|
U32 width = bmp->getWidth();
|
||||||
|
bool hasAlpha = bmp->getHasTransparency();
|
||||||
|
U32 depth;
|
||||||
|
|
||||||
|
if (hasAlpha)
|
||||||
|
{
|
||||||
|
pitch = 4 * width;
|
||||||
|
depth = 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pitch = 3 * width;
|
||||||
|
depth = 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 rmask, gmask, bmask, amask;
|
||||||
|
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||||
|
{
|
||||||
|
S32 shift = hasAlpha ? 8 : 0;
|
||||||
|
rmask = 0xff000000 >> shift;
|
||||||
|
gmask = 0x00ff0000 >> shift;
|
||||||
|
bmask = 0x0000ff00 >> shift;
|
||||||
|
amask = 0x000000ff >> shift;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rmask = 0x000000ff;
|
||||||
|
gmask = 0x0000ff00;
|
||||||
|
bmask = 0x00ff0000;
|
||||||
|
amask = hasAlpha ? 0xff000000 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface* iconSurface = SDL_CreateRGBSurfaceFrom(bmp->getAddress(0, 0), bmp->getWidth(), bmp->getHeight(), depth, pitch, rmask, gmask, bmask, amask);
|
||||||
|
|
||||||
|
SDL_SetWindowIcon(window->mWindowHandle, iconSurface);
|
||||||
|
|
||||||
|
SDL_FreeSurface(iconSurface);
|
||||||
|
}
|
||||||
|
|
||||||
if(device)
|
if(device)
|
||||||
{
|
{
|
||||||
window->mDevice = device;
|
window->mDevice = device;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ $defaultGame = "scripts";
|
||||||
|
|
||||||
// Set profile directory
|
// Set profile directory
|
||||||
$Pref::Video::ProfilePath = "core/profile";
|
$Pref::Video::ProfilePath = "core/profile";
|
||||||
|
$Core::windowIcon = "core/torque.png";
|
||||||
|
$Core::splashWindowImage = "art/gui/splash.bmp";
|
||||||
|
|
||||||
function createCanvas(%windowTitle)
|
function createCanvas(%windowTitle)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ $defaultGame = "scripts";
|
||||||
|
|
||||||
// Set profile directory
|
// Set profile directory
|
||||||
$Pref::Video::ProfilePath = "core/profile";
|
$Pref::Video::ProfilePath = "core/profile";
|
||||||
|
$Core::windowIcon = "core/torque.png";
|
||||||
|
$Core::splashWindowImage = "art/gui/splash.bmp";
|
||||||
|
|
||||||
function createCanvas(%windowTitle)
|
function createCanvas(%windowTitle)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue