[LoadingWindow] Added the ability for themes to have custom splash banners. (Currently Windows-only.)
This commit is contained in:
@@ -8,6 +8,11 @@ ________________________________________________________________________________
|
|||||||
StepMania 5.0 ????????? | 20110???
|
StepMania 5.0 ????????? | 20110???
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
2011/07/19
|
||||||
|
----------
|
||||||
|
* [LoadingWindow] Added the ability for themes to have custom splash banners.
|
||||||
|
(Currently Windows-only.) [AJ]
|
||||||
|
|
||||||
2011/07/17
|
2011/07/17
|
||||||
----------
|
----------
|
||||||
* [Cache] No longer store #NOTES in the cache. This should speed things up
|
* [Cache] No longer store #NOTES in the cache. This should speed things up
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
+3
-46
@@ -70,7 +70,6 @@
|
|||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "archutils/Win32/AppInstance.h" // used by SetWindowsHookEx -Aldo
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ShutdownGame();
|
void ShutdownGame();
|
||||||
@@ -935,32 +934,6 @@ static void ApplyLogPreferences()
|
|||||||
|
|
||||||
static LocalizedString COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." );
|
static LocalizedString COULDNT_OPEN_LOADING_WINDOW( "StepMania", "Couldn't open any loading windows." );
|
||||||
|
|
||||||
#if defined(WIN32)
|
|
||||||
// Low Level hooks go here, I only added Windows Key, but letting the player choose which system shortcuts
|
|
||||||
// wants to get disabled via PREFSMAN would be nice -Aldo
|
|
||||||
LRESULT CALLBACK SpecialKeysHook(int code,WPARAM wparam,LPARAM lparam)
|
|
||||||
{
|
|
||||||
if( HOOKS->AppHasFocus() ) // only disable system shortcuts when the game has focus
|
|
||||||
{
|
|
||||||
PKBDLLHOOKSTRUCT key = (PKBDLLHOOKSTRUCT)lparam;
|
|
||||||
|
|
||||||
switch(wparam)
|
|
||||||
{
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
case WM_KEYUP:
|
|
||||||
case WM_SYSKEYDOWN:
|
|
||||||
case WM_SYSKEYUP:
|
|
||||||
if(key->vkCode==VK_LWIN || key->vkCode==VK_RWIN)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CallNextHookEx(0,code,wparam,lparam);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
RageThreadRegister thread( "Main thread" );
|
RageThreadRegister thread( "Main thread" );
|
||||||
@@ -1074,13 +1047,14 @@ int main(int argc, char* argv[])
|
|||||||
GAMESTATE->m_bDopefish = true;
|
GAMESTATE->m_bDopefish = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Now that THEME is loaded, load the icon for the current theme into
|
/* Now that THEME is loaded, load the icon and splash for the current
|
||||||
* the loading window. */
|
* theme into the loading window. */
|
||||||
RString sError;
|
RString sError;
|
||||||
RageSurface *pIcon = RageSurfaceUtils::LoadFile( THEME->GetPathG( "Common", "window icon" ), sError );
|
RageSurface *pIcon = RageSurfaceUtils::LoadFile( THEME->GetPathG( "Common", "window icon" ), sError );
|
||||||
if( pIcon )
|
if( pIcon )
|
||||||
pLoadingWindow->SetIcon( pIcon );
|
pLoadingWindow->SetIcon( pIcon );
|
||||||
delete pIcon;
|
delete pIcon;
|
||||||
|
pLoadingWindow->SetSplash( THEME->GetPathG("Common","splash") );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PREFSMAN->m_iSoundWriteAhead )
|
if( PREFSMAN->m_iSoundWriteAhead )
|
||||||
@@ -1151,23 +1125,6 @@ int main(int argc, char* argv[])
|
|||||||
StoreActualGraphicOptions();
|
StoreActualGraphicOptions();
|
||||||
LOG->Info( "%s", GetActualGraphicOptionsString().c_str() );
|
LOG->Info( "%s", GetActualGraphicOptionsString().c_str() );
|
||||||
|
|
||||||
#if defined(WIN32)
|
|
||||||
// Apply Low Level hooks just after creating the display, so we have a valid
|
|
||||||
// HINSTANCE, rather than a NULL one -Aldo
|
|
||||||
AppInstance inst;
|
|
||||||
HHOOK hook;
|
|
||||||
hook = SetWindowsHookEx(
|
|
||||||
WH_KEYBOARD_LL,
|
|
||||||
SpecialKeysHook,
|
|
||||||
inst.Get(),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
if(!hook)
|
|
||||||
{
|
|
||||||
LOG->Warn("SetWindowsHookEx: Could not create hook (Error %d).", GetLastError());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SONGMAN->PreloadSongImages();
|
SONGMAN->PreloadSongImages();
|
||||||
|
|
||||||
/* Input handlers can have dependences on the video system so
|
/* Input handlers can have dependences on the video system so
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public:
|
|||||||
|
|
||||||
virtual void SetText( RString str ) = 0;
|
virtual void SetText( RString str ) = 0;
|
||||||
virtual void SetIcon( const RageSurface *pIcon ) { }
|
virtual void SetIcon( const RageSurface *pIcon ) { }
|
||||||
|
virtual void SetSplash( const RString sPath ) { }
|
||||||
virtual void SetProgress( const int progress ) { m_progress=progress; }
|
virtual void SetProgress( const int progress ) { m_progress=progress; }
|
||||||
virtual void SetTotalWork( const int totalWork ) { m_totalWork=totalWork; }
|
virtual void SetTotalWork( const int totalWork ) { m_totalWork=totalWork; }
|
||||||
virtual void SetIndeterminate( bool indeterminate ) { m_indeterminate=indeterminate; }
|
virtual void SetIndeterminate( bool indeterminate ) { m_indeterminate=indeterminate; }
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public:
|
|||||||
RString Init();
|
RString Init();
|
||||||
~LoadingWindow_Gtk();
|
~LoadingWindow_Gtk();
|
||||||
void SetText( RString str );
|
void SetText( RString str );
|
||||||
|
void SetSplash( const RString str ) {}
|
||||||
void SetProgress( const int progress );
|
void SetProgress( const int progress );
|
||||||
void SetTotalWork( const int totalWork );
|
void SetTotalWork( const int totalWork );
|
||||||
void SetIndeterminate( bool indeterminate );
|
void SetIndeterminate( bool indeterminate );
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public:
|
|||||||
LoadingWindow_MacOSX();
|
LoadingWindow_MacOSX();
|
||||||
~LoadingWindow_MacOSX();
|
~LoadingWindow_MacOSX();
|
||||||
void SetText( RString str );
|
void SetText( RString str );
|
||||||
|
void SetSplash( const RString path ) {}
|
||||||
void SetProgress( const int progress );
|
void SetProgress( const int progress );
|
||||||
void SetTotalWork( const int totalWork );
|
void SetTotalWork( const int totalWork );
|
||||||
void SetIndeterminate( bool indeterminate );
|
void SetIndeterminate( bool indeterminate );
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class LoadingWindow_Null: public LoadingWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void SetText( RString str ) { }
|
void SetText( RString str ) { }
|
||||||
|
void SetSplash( RString str ) { }
|
||||||
};
|
};
|
||||||
#define USE_LOADING_WINDOW_NULL
|
#define USE_LOADING_WINDOW_NULL
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ static HBITMAP g_hBitmap = NULL;
|
|||||||
|
|
||||||
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
|
||||||
|
// Load a RageSurface into a GDI surface.
|
||||||
/* Load a RageSurface into a GDI surface. */
|
|
||||||
static HBITMAP LoadWin32Surface( RageSurface *&s )
|
static HBITMAP LoadWin32Surface( RageSurface *&s )
|
||||||
{
|
{
|
||||||
RageSurfaceUtils::ConvertSurface( s, s->w, s->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0 );
|
RageSurfaceUtils::ConvertSurface( s, s->w, s->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0 );
|
||||||
@@ -35,7 +34,7 @@ static HBITMAP LoadWin32Surface( RageSurface *&s )
|
|||||||
HDC BitmapDC = CreateCompatibleDC( hScreen );
|
HDC BitmapDC = CreateCompatibleDC( hScreen );
|
||||||
SelectObject( BitmapDC, bitmap );
|
SelectObject( BitmapDC, bitmap );
|
||||||
|
|
||||||
/* This is silly, but simple. We only do this once, on a small image. */
|
// This is silly, but simple. We only do this once, on a small image.
|
||||||
for( int y = 0; y < s->h; ++y )
|
for( int y = 0; y < s->h; ++y )
|
||||||
{
|
{
|
||||||
unsigned const char *line = ((unsigned char *) s->pixels) + (y * s->pitch);
|
unsigned const char *line = ((unsigned char *) s->pixels) + (y * s->pitch);
|
||||||
@@ -62,7 +61,7 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd )
|
|||||||
if( pSurface == NULL )
|
if( pSurface == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Resize the splash image to fit the dialog. Stretch to fit horizontally,
|
/* Resize the splash image to fit the dialog. Stretch to fit horizontally,
|
||||||
* maintaining aspect ratio. */
|
* maintaining aspect ratio. */
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
@@ -82,7 +81,6 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd )
|
|||||||
|
|
||||||
INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
|
|
||||||
LoadingWindow_Win32 *self;
|
LoadingWindow_Win32 *self;
|
||||||
|
|
||||||
if(msg==WM_INITDIALOG) {
|
if(msg==WM_INITDIALOG) {
|
||||||
@@ -136,7 +134,7 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara
|
|||||||
|
|
||||||
void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon )
|
void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon )
|
||||||
{
|
{
|
||||||
if( m_hIcon != NULL )
|
if( g_hBitmap != NULL )
|
||||||
DestroyIcon( m_hIcon );
|
DestroyIcon( m_hIcon );
|
||||||
|
|
||||||
m_hIcon = IconFromSurface( pIcon );
|
m_hIcon = IconFromSurface( pIcon );
|
||||||
@@ -144,6 +142,26 @@ void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon )
|
|||||||
SetClassLong( hwnd, GCL_HICON, (LONG) m_hIcon );
|
SetClassLong( hwnd, GCL_HICON, (LONG) m_hIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadingWindow_Win32::SetSplash( const RString sPath )
|
||||||
|
{
|
||||||
|
if( g_hBitmap != NULL )
|
||||||
|
{
|
||||||
|
DeleteObject( g_hBitmap );
|
||||||
|
g_hBitmap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hBitmap = LoadWin32Surface( sPath, hwnd );
|
||||||
|
if( g_hBitmap != NULL )
|
||||||
|
{
|
||||||
|
SendDlgItemMessage(
|
||||||
|
hwnd, IDC_SPLASH,
|
||||||
|
STM_SETIMAGE,
|
||||||
|
(WPARAM) IMAGE_BITMAP,
|
||||||
|
(LPARAM) (HANDLE) g_hBitmap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadingWindow_Win32::LoadingWindow_Win32()
|
LoadingWindow_Win32::LoadingWindow_Win32()
|
||||||
{
|
{
|
||||||
INITCOMMONCONTROLSEX cceData;
|
INITCOMMONCONTROLSEX cceData;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public:
|
|||||||
|
|
||||||
void SetText( RString sText );
|
void SetText( RString sText );
|
||||||
void SetIcon( const RageSurface *pIcon );
|
void SetIcon( const RageSurface *pIcon );
|
||||||
|
void SetSplash( const RString sPath );
|
||||||
void SetProgress( const int progress );
|
void SetProgress( const int progress );
|
||||||
void SetTotalWork( const int totalWork );
|
void SetTotalWork( const int totalWork );
|
||||||
void SetIndeterminate( bool indeterminate );
|
void SetIndeterminate( bool indeterminate );
|
||||||
|
|||||||
Reference in New Issue
Block a user