no message
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "ScreenDimensions.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "RageBitmapTexture.h"
|
||||
|
||||
|
||||
const CString VIS_DIR = "Visualizations\\";
|
||||
@@ -45,10 +46,8 @@ bool Background::LoadFromSong( Song &song )
|
||||
else
|
||||
{
|
||||
// load the static background (if available), and a visualization
|
||||
if( song.HasBackground() )
|
||||
m_sprSongBackground.Load( song.GetBackgroundPath() );
|
||||
else
|
||||
m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND) );
|
||||
if( song.HasBackground() ) m_sprSongBackground.Load( song.GetBackgroundPath(), HINT_DITHER );
|
||||
else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), HINT_DITHER );
|
||||
|
||||
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
||||
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
{
|
||||
Load( THEME->GetPathTo(GRAPHIC_MUSIC_STATUS_ICONS) );
|
||||
StopAnimating();
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
m_bIsNew = false;
|
||||
m_Rank = NO_CROWN;
|
||||
@@ -36,10 +37,13 @@ public:
|
||||
|
||||
SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // invisible
|
||||
}
|
||||
void SetNew( bool bIsNew )
|
||||
void SetIsNew( bool bIsNew )
|
||||
{
|
||||
m_bIsNew = bIsNew;
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
if( m_bIsNew )
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
else
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
SetState( 0 );
|
||||
};
|
||||
void SetBlinking( bool bIsBlinking )
|
||||
|
||||
@@ -54,23 +54,27 @@ const int NUM_SECTION_TINTS = sizeof(COLOR_SECTION_TINTS) / sizeof(D3DXCOLOR);
|
||||
D3DXCOLOR COLOR_SECTION_LETTER = D3DXCOLOR(1,1,0.3f,1);
|
||||
|
||||
|
||||
|
||||
void WheelItem::LoadFromSong( Song &song )
|
||||
WheelItem::WheelItem()
|
||||
{
|
||||
m_pSong = NULL;
|
||||
}
|
||||
|
||||
|
||||
void WheelItem::LoadFromSong( Song* pSong )
|
||||
{
|
||||
ASSERT( pSong != NULL );
|
||||
|
||||
m_pSong = pSong;
|
||||
|
||||
m_WheelItemType = TYPE_MUSIC;
|
||||
|
||||
m_MusicStatusDisplay.SetIsNew( m_pSong->GetNumTimesPlayed() == 0 );
|
||||
m_MusicStatusDisplay.SetXY( -132, 0 );
|
||||
this->AddActor( &m_MusicStatusDisplay );
|
||||
|
||||
m_Banner.LoadFromSong( pSong );
|
||||
m_Banner.SetHorizAlign( align_left );
|
||||
m_Banner.SetXY( 15, 0 );
|
||||
this->AddActor( &m_Banner );
|
||||
|
||||
|
||||
m_pSong = &song;
|
||||
m_Banner.LoadFromSong( song );
|
||||
m_MusicStatusDisplay.SetNew( m_pSong->GetNumTimesPlayed() == 0 );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void WheelItem::LoadFromSectionName( CString sSectionName )
|
||||
@@ -79,18 +83,16 @@ void WheelItem::LoadFromSectionName( CString sSectionName )
|
||||
|
||||
m_sprSectionBackground.Load( THEME->GetPathTo(GRAPHIC_SECTION_BACKGROUND) );
|
||||
m_sprSectionBackground.SetXY( -30, 0 );
|
||||
this->AddActor( &m_sprSectionBackground );
|
||||
|
||||
m_textSectionName.Load( THEME->GetPathTo(FONT_OUTLINE) );
|
||||
m_textSectionName.TurnShadowOff();
|
||||
m_textSectionName.SetText( sSectionName );
|
||||
m_textSectionName.SetHorizAlign( align_left );
|
||||
m_textSectionName.SetXY( -100, 0 );
|
||||
m_textSectionName.SetXY( -85, 0 );
|
||||
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER );
|
||||
m_textSectionName.SetZoom( 1.5f );
|
||||
this->AddActor( &m_textSectionName );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void WheelItem::SetTintColor( D3DXCOLOR c )
|
||||
{
|
||||
@@ -99,7 +101,7 @@ void WheelItem::SetTintColor( D3DXCOLOR c )
|
||||
|
||||
void WheelItem::SetDiffuseColor( D3DXCOLOR c )
|
||||
{
|
||||
ActorFrame::SetDiffuseColor( c );
|
||||
Actor::SetDiffuseColor( c );
|
||||
|
||||
|
||||
D3DXCOLOR colorTempTint = m_colorTint;
|
||||
@@ -122,6 +124,35 @@ void WheelItem::SetDiffuseColor( D3DXCOLOR c )
|
||||
|
||||
};
|
||||
|
||||
void WheelItem::Update( float fDeltaTime )
|
||||
{
|
||||
switch( m_WheelItemType )
|
||||
{
|
||||
case TYPE_SECTION:
|
||||
m_sprSectionBackground.Update( fDeltaTime );
|
||||
m_textSectionName.Update( fDeltaTime );
|
||||
break;
|
||||
case TYPE_MUSIC:
|
||||
m_MusicStatusDisplay.Update( fDeltaTime );
|
||||
m_Banner.Update( fDeltaTime );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WheelItem::RenderPrimitives()
|
||||
{
|
||||
switch( m_WheelItemType )
|
||||
{
|
||||
case TYPE_SECTION:
|
||||
m_sprSectionBackground.Draw();
|
||||
m_textSectionName.Draw();
|
||||
break;
|
||||
case TYPE_MUSIC:
|
||||
m_MusicStatusDisplay.Draw();
|
||||
m_Banner.Draw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -222,8 +253,7 @@ void MusicWheel::RebuildWheelItems()
|
||||
ASSERT( true ); // unhandled SORT_ORDER
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
m_WheelItems.RemoveAll(); // clear out the previous wheel items...
|
||||
|
||||
// ...and load new ones
|
||||
@@ -238,7 +268,7 @@ void MusicWheel::RebuildWheelItems()
|
||||
for( int i=0; i< arraySongs.GetSize(); i++ )
|
||||
{
|
||||
Song* pSong = arraySongs[i];
|
||||
m_WheelItems[i].LoadFromSong( *pSong );
|
||||
m_WheelItems[i].LoadFromSong( pSong );
|
||||
m_WheelItems[i].SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] );
|
||||
}
|
||||
}
|
||||
@@ -269,7 +299,7 @@ void MusicWheel::RebuildWheelItems()
|
||||
if( sThisSection == m_sExpandedSectionName ) // this song is in the expanded section
|
||||
{
|
||||
WheelItem &WI = m_WheelItems[iCurWheelItem++];
|
||||
WI.LoadFromSong( *pSong );
|
||||
WI.LoadFromSong( pSong );
|
||||
WI.SetTintColor( *m_mapGroupNameToColorPtr[pSong->GetGroupName()] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ const WindowMessage SM_PlaySongSample = WindowMessage(SM_User+48);
|
||||
|
||||
|
||||
|
||||
class WheelItem : public ActorFrame
|
||||
class WheelItem : public Actor
|
||||
{
|
||||
public:
|
||||
WheelItem()
|
||||
{
|
||||
m_pSong = NULL;
|
||||
};
|
||||
WheelItem();
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void RenderPrimitives();
|
||||
|
||||
void SetTintColor( D3DXCOLOR c );
|
||||
void SetDiffuseColor( D3DXCOLOR c );
|
||||
@@ -52,10 +52,9 @@ public:
|
||||
return m_textSectionName.GetText();
|
||||
};
|
||||
|
||||
void LoadFromSong( Song &song );
|
||||
void LoadFromSong( Song* pSong );
|
||||
void LoadFromSectionName( CString sSectionName );
|
||||
|
||||
|
||||
// common
|
||||
enum WheelItemType { TYPE_SECTION, TYPE_MUSIC };
|
||||
WheelItemType m_WheelItemType;
|
||||
|
||||
@@ -66,8 +66,6 @@ bool IsAnInt( CString s )
|
||||
//-----------------------------------------------------------------------------
|
||||
void RageLogStart()
|
||||
{
|
||||
#if defined(DEBUG) | defined(_DEBUG)
|
||||
|
||||
DeleteFile( g_sLogFileName );
|
||||
DeleteFile( g_sErrorFileName );
|
||||
|
||||
@@ -82,8 +80,6 @@ void RageLogStart()
|
||||
RageLog( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d",
|
||||
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond );
|
||||
RageLog( "\n" );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +95,9 @@ void RageLog( LPCTSTR fmt, ...)
|
||||
CString sBuff = vssprintf( fmt, va );
|
||||
sBuff += "\n";
|
||||
|
||||
fprintf(g_fileLog, sBuff);
|
||||
fprintf(g_fileLog, sBuff);
|
||||
fclose( g_fileLog );
|
||||
g_fileLog = fopen( g_sLogFileName, "w" );
|
||||
}
|
||||
|
||||
void RageLogHr( HRESULT hr, LPCTSTR fmt, ...)
|
||||
@@ -408,13 +406,17 @@ VOID DisplayErrorAndDie( CString sError )
|
||||
}
|
||||
sError += "\n\n" + fromClipboard;
|
||||
*/
|
||||
|
||||
#ifdef DEBUG // don't use error handler in Release mode
|
||||
AfxMessageBox( sError );
|
||||
exit(1);
|
||||
#else
|
||||
FILE* fp = fopen( g_sErrorFileName, "w" );
|
||||
|
||||
fprintf( fp, sError );
|
||||
fclose( fp );
|
||||
|
||||
exit(1);
|
||||
// generate an exception so the error handler shows
|
||||
int d = 0;
|
||||
int ksg = 3/d;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -125,6 +125,29 @@ END
|
||||
//
|
||||
|
||||
SPLASH BITMAP DISCARDABLE "splash.bmp"
|
||||
BITMAP_ERROR BITMAP DISCARDABLE "error.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ERROR_DIALOG DIALOG DISCARDABLE 0, 0, 332, 234
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
|
||||
CAPTION "StepMania Error"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_ERROR,5,80,320,80,ES_CENTER | ES_MULTILINE |
|
||||
ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,265,215,60,15
|
||||
CONTROL 129,IDC_STATIC,"Static",SS_BITMAP,0,0,258,37
|
||||
LTEXT "We're sorry. An error has occurred while running StepMania.\r\n\r\nMore specific details about the error may be listeted in the box below:",
|
||||
IDC_STATIC,7,47,298,28
|
||||
PUSHBUTTON "Restart StepMania",IDC_BUTTON_RESTART,175,215,80,15
|
||||
PUSHBUTTON "Report the Error",IDC_BUTTON_REPORT,120,190,80,15
|
||||
PUSHBUTTON "View Log",IDC_BUTTON_VIEW_LOG,120,170,80,15
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+223
-120
@@ -30,6 +30,8 @@
|
||||
#include "WindowTitleMenu.h"
|
||||
#include "WindowPlayerOptions.h"
|
||||
|
||||
#include "ScreenDimensions.h"
|
||||
|
||||
#include <DXUtil.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -45,12 +47,9 @@
|
||||
const CString g_sAppName = "StepMania";
|
||||
const CString g_sAppClassName = "StepMania Class";
|
||||
|
||||
|
||||
HWND g_hWndMain; // Main Window Handle
|
||||
HINSTANCE g_hInstance; // The Handle to Window Instance
|
||||
|
||||
#include "ScreenDimensions.h"
|
||||
|
||||
HWND g_hWndMain; // Main Window Handle
|
||||
HINSTANCE g_hInstance; // The Handle to Window Instance
|
||||
HANDLE g_hMutex; // Used to check if an instance of our app is already
|
||||
const DWORD g_dwWindowStyle = WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU;
|
||||
|
||||
|
||||
@@ -65,6 +64,7 @@ BOOL g_bIsActive = FALSE; // Whether the focus is on our app
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main game functions
|
||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
void Update(); // Update the game logic
|
||||
void Render(); // Render a frame
|
||||
@@ -78,8 +78,6 @@ VOID DestroyObjects(); // deallocate game objects when we're done with them
|
||||
|
||||
BOOL SwitchDisplayMode();// BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP );
|
||||
|
||||
BOOL WeAreAlone( LPSTR szName );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
@@ -87,114 +85,234 @@ BOOL WeAreAlone( LPSTR szName );
|
||||
//-----------------------------------------------------------------------------
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
||||
{
|
||||
if( !WeAreAlone("StepMania") )
|
||||
|
||||
#ifndef DEBUG // don't use error handler in Release mode
|
||||
try
|
||||
{
|
||||
RageError( "StepMania is already running!" );
|
||||
}
|
||||
|
||||
// Make sure the current directory is the root program directory
|
||||
if( !DoesFileExist("Songs") )
|
||||
{
|
||||
// change dir to path of the execuctable
|
||||
TCHAR szFullAppPath[MAX_PATH];
|
||||
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
|
||||
|
||||
// strip off executable name
|
||||
LPSTR pLastBackslash = strrchr(szFullAppPath, '\\');
|
||||
*pLastBackslash = '\0'; // terminate the string
|
||||
|
||||
SetCurrentDirectory(szFullAppPath);
|
||||
}
|
||||
|
||||
|
||||
CoInitialize (NULL); // Initialize COM
|
||||
|
||||
// Register the window class
|
||||
WNDCLASS wndClass = {
|
||||
0,
|
||||
WndProc, // callback handler
|
||||
0, // cbClsExtra;
|
||||
0, // cbWndExtra;
|
||||
hInstance,
|
||||
LoadIcon( hInstance, MAKEINTRESOURCE(IDI_ICON) ),
|
||||
LoadCursor( hInstance, IDC_ARROW),
|
||||
(HBRUSH)GetStockObject( BLACK_BRUSH ),
|
||||
NULL, // lpszMenuName;
|
||||
g_sAppClassName // lpszClassName;
|
||||
};
|
||||
RegisterClass( &wndClass );
|
||||
|
||||
|
||||
// Set the window's initial width
|
||||
RECT rcWnd;
|
||||
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
AdjustWindowRect( &rcWnd, g_dwWindowStyle, FALSE );
|
||||
|
||||
|
||||
// Create our main window
|
||||
g_hWndMain = CreateWindow(
|
||||
g_sAppClassName,// pointer to registered class name
|
||||
g_sAppName, // pointer to window name
|
||||
g_dwWindowStyle, // window style
|
||||
CW_USEDEFAULT, // horizontal position of window
|
||||
CW_USEDEFAULT, // vertical position of window
|
||||
RECTWIDTH(rcWnd), // window width
|
||||
RECTHEIGHT(rcWnd),// window height
|
||||
NULL, // handle to parent or owner window
|
||||
NULL, // handle to menu, or child-window identifier
|
||||
hInstance, // handle to application instance
|
||||
NULL // pointer to window-creation data
|
||||
);
|
||||
if( NULL == g_hWndMain )
|
||||
exit(1);
|
||||
|
||||
|
||||
// Load keyboard accelerators
|
||||
HACCEL hAccel = LoadAccelerators( NULL, MAKEINTRESOURCE(IDR_MAIN_ACCEL) );
|
||||
|
||||
|
||||
// run the game
|
||||
CreateObjects( g_hWndMain ); // Create the game objects
|
||||
|
||||
// Now we're ready to recieve and process Windows messages.
|
||||
MSG msg;
|
||||
ZeroMemory( &msg, sizeof(msg) );
|
||||
|
||||
|
||||
while( WM_QUIT != msg.message )
|
||||
{
|
||||
// Look for messages, if none are found then
|
||||
// update the state and display it
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
|
||||
#endif
|
||||
// Check to see if the app is already running.
|
||||
g_hMutex = CreateMutex( NULL, TRUE, g_sAppName );
|
||||
if( GetLastError() == ERROR_ALREADY_EXISTS )
|
||||
{
|
||||
GetMessage(&msg, NULL, 0, 0 );
|
||||
CloseHandle( g_hMutex );
|
||||
RageError( "StepMania is already running!" );
|
||||
}
|
||||
|
||||
// Translate and dispatch the message
|
||||
if( 0 == TranslateAccelerator( g_hWndMain, hAccel, &msg ) )
|
||||
// Make sure the current directory is the root program directory
|
||||
if( !DoesFileExist("Songs") )
|
||||
{
|
||||
// change dir to path of the execuctable
|
||||
TCHAR szFullAppPath[MAX_PATH];
|
||||
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
|
||||
|
||||
// strip off executable name
|
||||
LPSTR pLastBackslash = strrchr(szFullAppPath, '\\');
|
||||
*pLastBackslash = '\0'; // terminate the string
|
||||
|
||||
SetCurrentDirectory(szFullAppPath);
|
||||
}
|
||||
|
||||
|
||||
CoInitialize (NULL); // Initialize COM
|
||||
|
||||
// Register the window class
|
||||
WNDCLASS wndClass = {
|
||||
0,
|
||||
WndProc, // callback handler
|
||||
0, // cbClsExtra;
|
||||
0, // cbWndExtra;
|
||||
hInstance,
|
||||
LoadIcon( hInstance, MAKEINTRESOURCE(IDI_ICON) ),
|
||||
LoadCursor( hInstance, IDC_ARROW),
|
||||
(HBRUSH)GetStockObject( BLACK_BRUSH ),
|
||||
NULL, // lpszMenuName;
|
||||
g_sAppClassName // lpszClassName;
|
||||
};
|
||||
RegisterClass( &wndClass );
|
||||
|
||||
|
||||
// Set the window's initial width
|
||||
RECT rcWnd;
|
||||
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
AdjustWindowRect( &rcWnd, g_dwWindowStyle, FALSE );
|
||||
|
||||
|
||||
// Create our main window
|
||||
g_hWndMain = CreateWindow(
|
||||
g_sAppClassName,// pointer to registered class name
|
||||
g_sAppName, // pointer to window name
|
||||
g_dwWindowStyle, // window style
|
||||
CW_USEDEFAULT, // horizontal position of window
|
||||
CW_USEDEFAULT, // vertical position of window
|
||||
RECTWIDTH(rcWnd), // window width
|
||||
RECTHEIGHT(rcWnd),// window height
|
||||
NULL, // handle to parent or owner window
|
||||
NULL, // handle to menu, or child-window identifier
|
||||
hInstance, // handle to application instance
|
||||
NULL // pointer to window-creation data
|
||||
);
|
||||
if( NULL == g_hWndMain )
|
||||
exit(1);
|
||||
|
||||
|
||||
// Load keyboard accelerators
|
||||
HACCEL hAccel = LoadAccelerators( NULL, MAKEINTRESOURCE(IDR_MAIN_ACCEL) );
|
||||
|
||||
// run the game
|
||||
CreateObjects( g_hWndMain ); // Create the game objects
|
||||
|
||||
// Now we're ready to recieve and process Windows messages.
|
||||
MSG msg;
|
||||
ZeroMemory( &msg, sizeof(msg) );
|
||||
|
||||
|
||||
while( WM_QUIT != msg.message )
|
||||
{
|
||||
// Look for messages, if none are found then
|
||||
// update the state and display it
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
GetMessage(&msg, NULL, 0, 0 );
|
||||
|
||||
// Translate and dispatch the message
|
||||
if( 0 == TranslateAccelerator( g_hWndMain, hAccel, &msg ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
else // No messages are waiting. Render a frame during idle time.
|
||||
{
|
||||
Update();
|
||||
Render();
|
||||
//if( !g_bFullscreen )
|
||||
::Sleep(0 ); // give some time for the movie decoding thread
|
||||
}
|
||||
} // end while( WM_QUIT != msg.message )
|
||||
else // No messages are waiting. Render a frame during idle time.
|
||||
{
|
||||
Update();
|
||||
Render();
|
||||
//if( !g_bFullscreen )
|
||||
::Sleep(0 ); // give some time for the movie decoding thread
|
||||
}
|
||||
} // end while( WM_QUIT != msg.message )
|
||||
|
||||
|
||||
// clean up after a normal exit
|
||||
DestroyObjects(); // deallocate our game objects and leave fullscreen
|
||||
DestroyWindow( g_hWndMain );
|
||||
UnregisterClass( g_sAppClassName, hInstance );
|
||||
CoUninitialize(); // Uninitialize COM
|
||||
// clean up after a normal exit
|
||||
CloseHandle( g_hMutex );
|
||||
DestroyObjects(); // deallocate our game objects and leave fullscreen
|
||||
DestroyWindow( g_hWndMain );
|
||||
UnregisterClass( g_sAppClassName, hInstance );
|
||||
CoUninitialize(); // Uninitialize COM
|
||||
|
||||
#ifndef DEBUG // don't use error handler in Release mode
|
||||
}
|
||||
catch(...) // catch all exceptions
|
||||
{
|
||||
CloseHandle( g_hMutex );
|
||||
DestroyObjects(); // deallocate our game objects and leave fullscreen
|
||||
ShowWindow( g_hWndMain, SW_HIDE );
|
||||
|
||||
DialogBox(
|
||||
hInstance,
|
||||
MAKEINTRESOURCE(IDD_ERROR_DIALOG),
|
||||
NULL,
|
||||
ErrorWndProc
|
||||
);
|
||||
exit( 1 );
|
||||
|
||||
DestroyWindow( g_hWndMain );
|
||||
UnregisterClass( g_sAppClassName, hInstance );
|
||||
CoUninitialize(); // Uninitialize COM
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: ErrorWndProc()
|
||||
// Desc: Callback for all Windows messages
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( msg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
CString sError;
|
||||
CStdioFile file;
|
||||
if( file.Open("error.txt", CFile::modeRead) )
|
||||
{
|
||||
CString sBuffer;
|
||||
while( file.ReadString(sBuffer) )
|
||||
{
|
||||
sError += sBuffer + "\r\n";
|
||||
}
|
||||
}
|
||||
sError.TrimRight();
|
||||
if( sError == "" )
|
||||
sError = "Program Crash. Click 'View Log' for trace.";
|
||||
SendDlgItemMessage(
|
||||
hWnd,
|
||||
IDC_EDIT_ERROR,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)(LPCTSTR)sError
|
||||
);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_BUTTON_VIEW_LOG:
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
"notepad.exe log.txt", // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
NULL, // thread security attributes
|
||||
false, // handle inheritance flag
|
||||
0, // creation flags
|
||||
NULL, // pointer to new environment block
|
||||
NULL, // pointer to current directory name
|
||||
&si, // pointer to STARTUPINFO
|
||||
&pi // pointer to PROCESS_INFORMATION
|
||||
);
|
||||
}
|
||||
break;
|
||||
case IDC_BUTTON_REPORT:
|
||||
GotoURL( "Docs/report.htm" );
|
||||
break;
|
||||
case IDC_BUTTON_RESTART:
|
||||
{
|
||||
// Launch StepMania
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
"stepmania.exe", // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
NULL, // thread security attributes
|
||||
false, // handle inheritance flag
|
||||
0, // creation flags
|
||||
NULL, // pointer to new environment block
|
||||
NULL, // pointer to current directory name
|
||||
&si, // pointer to STARTUPINFO
|
||||
&pi // pointer to PROCESS_INFORMATION
|
||||
);
|
||||
}
|
||||
EndDialog( hWnd, 0 );
|
||||
break;
|
||||
// fall through
|
||||
case IDOK:
|
||||
EndDialog( hWnd, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WndProc()
|
||||
@@ -648,21 +766,6 @@ BOOL SwitchDisplayMode()//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WeAreAlone()
|
||||
// Desc: check for DirectX 8
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL WeAreAlone (LPSTR szName)
|
||||
{
|
||||
HANDLE hMutex = CreateMutex (NULL, TRUE, szName);
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
CloseHandle(hMutex);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ RSC=rc.exe
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 1
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../Release"
|
||||
# PROP Output_Dir "../"
|
||||
# PROP Intermediate_Dir "../Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
@@ -69,7 +69,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "DEBUG" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
@@ -737,6 +737,10 @@ SOURCE=.\TipDisplay.h
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\error.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\splash.bmp
|
||||
# End Source File
|
||||
# End Target
|
||||
|
||||
@@ -27,18 +27,6 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "smlauncher"=.\smlauncher\smlauncher.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "smpackage"=.\smpackage\smpackage.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
||||
@@ -30,27 +30,28 @@ TextBanner::TextBanner()
|
||||
m_textSubTitle.SetHorizAlign( align_left );
|
||||
m_textArtist.SetHorizAlign( align_left );
|
||||
|
||||
m_rect.ScaleToCover( CRect( -TEXT_BANNER_WIDTH/2,
|
||||
-TEXT_BANNER_HEIGHT/2,
|
||||
TEXT_BANNER_WIDTH/2,
|
||||
TEXT_BANNER_HEIGHT/2 )
|
||||
);
|
||||
//this->AddActor( &m_rect );
|
||||
|
||||
this->AddActor( &m_textTitle );
|
||||
this->AddActor( &m_textSubTitle );
|
||||
this->AddActor( &m_textArtist );
|
||||
}
|
||||
|
||||
|
||||
bool TextBanner::LoadFromSong( Song &song )
|
||||
bool TextBanner::LoadFromSong( Song* pSong )
|
||||
{
|
||||
CString sTitle = song.GetTitle();
|
||||
if( pSong == NULL )
|
||||
{
|
||||
m_textTitle.SetText( "" );
|
||||
m_textSubTitle.SetText( "" );
|
||||
m_textArtist.SetText( "" );
|
||||
return true;
|
||||
}
|
||||
|
||||
CString sTitle = pSong->GetTitle();
|
||||
CString sSubTitle;
|
||||
|
||||
m_textTitle.SetText( sTitle );
|
||||
m_textSubTitle.SetText( sSubTitle );
|
||||
m_textArtist.SetText( "/" + song.GetArtist() );
|
||||
m_textArtist.SetText( "/" + pSong->GetArtist() );
|
||||
|
||||
|
||||
float fTitleZoom, fSubTitleZoom, fArtistZoom;
|
||||
|
||||
@@ -26,13 +26,10 @@ class TextBanner : public ActorFrame
|
||||
{
|
||||
public:
|
||||
TextBanner();
|
||||
bool LoadFromSong( Song &song );
|
||||
bool LoadFromSong( Song* pSong );
|
||||
|
||||
private:
|
||||
BitmapText m_textTitle, m_textSubTitle, m_textArtist;
|
||||
|
||||
RectangleActor m_rect;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -2,11 +2,17 @@
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by StepMania.RC
|
||||
//
|
||||
#define IDD_ERROR_DIALOG 111
|
||||
#define BITMAP_ERROR 129
|
||||
#define IDR_MAIN_ACCEL 1001
|
||||
#define IDC_BUTTON_RESTART 1001
|
||||
#define IDM_TOGGLEFULLSCREEN 1002
|
||||
#define IDC_BUTTON_REPORT 1002
|
||||
#define IDM_CHANGERESOLUTION 1003
|
||||
#define IDC_BUTTON_VIEW_LOG 1003
|
||||
#define IDM_CHANGEDISPLAYCOLOR 1004
|
||||
#define IDM_CHANGETEXTURECOLOR 1005
|
||||
#define IDC_EDIT_ERROR 1005
|
||||
#define IDM_TOGGLESTATISTICS 1006
|
||||
#define IDI_ICON 1007
|
||||
#define IDC_CURSOR 1008
|
||||
@@ -16,7 +22,7 @@
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 111
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40009
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
||||
Reference in New Issue
Block a user