add ScreenSetTime
This commit is contained in:
@@ -3788,7 +3788,7 @@ PrevScreen=ScreenTitleMenu
|
|||||||
# when using entries that change the screen; otherwise, the only way to
|
# when using entries that change the screen; otherwise, the only way to
|
||||||
# exit the screen when in arcade mode is "exit".
|
# exit the screen when in arcade mode is "exit".
|
||||||
|
|
||||||
LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
|
LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
|
||||||
OptionMenuFlags=together;forceallplayers;smnavigation
|
OptionMenuFlags=together;forceallplayers;smnavigation
|
||||||
# This NextScreen is only used for the "exit" choice.
|
# This NextScreen is only used for the "exit" choice.
|
||||||
Line1=list,Appearance Options
|
Line1=list,Appearance Options
|
||||||
@@ -3807,6 +3807,7 @@ Line13=list,Profile Options
|
|||||||
Line14=list,Other Options
|
Line14=list,Other Options
|
||||||
Line15=list,Reload Songs/Courses
|
Line15=list,Reload Songs/Courses
|
||||||
Line16=list,Test Input
|
Line16=list,Test Input
|
||||||
|
Line17=list,Set Machine Time
|
||||||
|
|
||||||
[TextBanner]
|
[TextBanner]
|
||||||
TitleX=-90
|
TitleX=-90
|
||||||
@@ -4234,7 +4235,7 @@ Background OptionsDefault=
|
|||||||
Background Options,1=screen,ScreenBackgroundOptions;name,BackgroundOptions
|
Background Options,1=screen,ScreenBackgroundOptions;name,BackgroundOptions
|
||||||
Bookkeeping=1,together
|
Bookkeeping=1,together
|
||||||
BookkeepingDefault=
|
BookkeepingDefault=
|
||||||
Bookkeeping,1=screen,ScreenBookkeeping;name,Bookkeeping
|
Bookkeeping,1=screen,ScreenSetTime;name,Bookkeeping
|
||||||
Center Image=1,together
|
Center Image=1,together
|
||||||
Center ImageDefault=
|
Center ImageDefault=
|
||||||
Center Image,1=screen,ScreenCenterImage;name,CenterImage
|
Center Image,1=screen,ScreenCenterImage;name,CenterImage
|
||||||
@@ -4271,6 +4272,9 @@ Reload Songs/Courses,1=screen,ScreenReloadSongs;name,ReloadSongs
|
|||||||
Test Input=1,together
|
Test Input=1,together
|
||||||
Test InputDefault=
|
Test InputDefault=
|
||||||
Test Input,1=screen,ScreenTestInput;name,TestInput
|
Test Input,1=screen,ScreenTestInput;name,TestInput
|
||||||
|
Set Machine Time=1,together
|
||||||
|
Set Machine TimeDefault=
|
||||||
|
Set Machine Time,1=screen,ScreenSetTime;name,SetMachineTime
|
||||||
|
|
||||||
[DancingCharacters]
|
[DancingCharacters]
|
||||||
#2D Character X/Y positions in relation to the center
|
#2D Character X/Y positions in relation to the center
|
||||||
@@ -4321,4 +4325,7 @@ EmptyName=STEP
|
|||||||
[ScreenDownloadMachineStats]
|
[ScreenDownloadMachineStats]
|
||||||
NextScreen=ScreenOptionsMenu
|
NextScreen=ScreenOptionsMenu
|
||||||
|
|
||||||
|
[ScreenSetTime]
|
||||||
|
StyleIcon=0
|
||||||
|
MemoryCardIcons=0
|
||||||
|
TimerSeconds=0
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ ScreenSelectCharacter.cpp ScreenSelectCharacter.h ScreenSelectCourse.cpp ScreenS
|
|||||||
ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectDifficultyEX.cpp ScreenSelectDifficultyEX.h \
|
ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectDifficultyEX.cpp ScreenSelectDifficultyEX.h \
|
||||||
ScreenSelectGroup.cpp ScreenSelectGroup.h ScreenSelectMaster.cpp ScreenSelectMaster.h \
|
ScreenSelectGroup.cpp ScreenSelectGroup.h ScreenSelectMaster.cpp ScreenSelectMaster.h \
|
||||||
ScreenSelectMode.cpp ScreenSelectMode.h ScreenSelectMusic.cpp ScreenSelectMusic.h ScreenSelectStyle.cpp ScreenSelectStyle.h \
|
ScreenSelectMode.cpp ScreenSelectMode.h ScreenSelectMusic.cpp ScreenSelectMusic.h ScreenSelectStyle.cpp ScreenSelectStyle.h \
|
||||||
|
ScreenSetTime.cpp ScreenSetTime.h \
|
||||||
ScreenSongOptions.cpp ScreenSongOptions.h ScreenStage.cpp ScreenStage.h \
|
ScreenSongOptions.cpp ScreenSongOptions.h ScreenStage.cpp ScreenStage.h \
|
||||||
ScreenStyleSplash.cpp ScreenStyleSplash.h ScreenTest.cpp ScreenTest.h ScreenTestFonts.cpp ScreenTestFonts.h \
|
ScreenStyleSplash.cpp ScreenStyleSplash.h ScreenTest.cpp ScreenTest.h ScreenTestFonts.cpp ScreenTestFonts.h \
|
||||||
ScreenTestInput.h ScreenTestInput.cpp ScreenTestSound.cpp ScreenTestSound.h ScreenTextEntry.cpp ScreenTextEntry.h ScreenTitleMenu.cpp ScreenTitleMenu.h \
|
ScreenTestInput.h ScreenTestInput.cpp ScreenTestSound.cpp ScreenTestSound.h ScreenTextEntry.cpp ScreenTextEntry.h ScreenTitleMenu.cpp ScreenTitleMenu.h \
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
|
|||||||
#include "ScreenEnding.h"
|
#include "ScreenEnding.h"
|
||||||
#include "ScreenAward.h"
|
#include "ScreenAward.h"
|
||||||
#include "ScreenDownloadMachineStats.h"
|
#include "ScreenDownloadMachineStats.h"
|
||||||
|
#include "ScreenSetTime.h"
|
||||||
|
|
||||||
Screen* Screen::Create( CString sClassName )
|
Screen* Screen::Create( CString sClassName )
|
||||||
{
|
{
|
||||||
@@ -357,6 +358,7 @@ Screen* Screen::Create( CString sClassName )
|
|||||||
IF_RETURN( ScreenEnding );
|
IF_RETURN( ScreenEnding );
|
||||||
IF_RETURN( ScreenAward );
|
IF_RETURN( ScreenAward );
|
||||||
IF_RETURN( ScreenDownloadMachineStats );
|
IF_RETURN( ScreenDownloadMachineStats );
|
||||||
|
IF_RETURN( ScreenSetTime );
|
||||||
|
|
||||||
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
|
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
#include "global.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenSetTime
|
||||||
|
|
||||||
|
Desc: Where the player maps device input to pad input.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScreenSetTime.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "ScreenManager.h"
|
||||||
|
#include "GameConstantsAndTypes.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "RageSounds.h"
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
#include "RageDisplay.h"
|
||||||
|
#include "Bookkeeper.h"
|
||||||
|
#include "arch/ArchHooks/ArchHooks.h"
|
||||||
|
|
||||||
|
ScreenSetTime::ScreenSetTime( CString sClassName ) : Screen( sClassName )
|
||||||
|
{
|
||||||
|
LOG->Trace( "ScreenSetTime::ScreenSetTime()" );
|
||||||
|
|
||||||
|
m_Selection = hour;
|
||||||
|
|
||||||
|
|
||||||
|
for( int i=0; i<NUM_SELECTIONS; i++ )
|
||||||
|
{
|
||||||
|
m_text[i].LoadFromFont( THEME->GetPathToF("Common title") );
|
||||||
|
m_text[i].SetDiffuse( RageColor(1,1,1,1) );
|
||||||
|
this->AddChild( &m_text[i] );
|
||||||
|
|
||||||
|
switch( i )
|
||||||
|
{
|
||||||
|
case hour: m_text[i].SetXY( 220, 200 ); break;
|
||||||
|
case minute: m_text[i].SetXY( 320, 200 ); break;
|
||||||
|
case second: m_text[i].SetXY( 420, 200 ); break;
|
||||||
|
case year: m_text[i].SetXY( 220, 280 ); break;
|
||||||
|
case month: m_text[i].SetXY( 320, 280 ); break;
|
||||||
|
case day: m_text[i].SetXY( 420, 280 ); break;
|
||||||
|
default: ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Selection = (Selection)0;
|
||||||
|
ChangeSelection( 0 );
|
||||||
|
|
||||||
|
m_Menu.Load( m_sName );
|
||||||
|
this->AddChild( &m_Menu );
|
||||||
|
|
||||||
|
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::Update( float fDelta )
|
||||||
|
{
|
||||||
|
Screen::Update( fDelta );
|
||||||
|
|
||||||
|
tm now = GetLocalTime();
|
||||||
|
m_text[hour].SetText( ssprintf("%02d",now.tm_hour) );
|
||||||
|
m_text[minute].SetText( ssprintf("%02d",now.tm_min) );
|
||||||
|
m_text[second].SetText( ssprintf("%02d",now.tm_sec) );
|
||||||
|
m_text[year].SetText( ssprintf("%02d",now.tm_year+1900) );
|
||||||
|
m_text[month].SetText( ssprintf("%02d",now.tm_mon) );
|
||||||
|
m_text[day].SetText( ssprintf("%02d",now.tm_mday) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::DrawPrimitives()
|
||||||
|
{
|
||||||
|
m_Menu.DrawBottomLayer();
|
||||||
|
Screen::DrawPrimitives();
|
||||||
|
m_Menu.DrawTopLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
|
{
|
||||||
|
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
|
||||||
|
return; // ignore
|
||||||
|
|
||||||
|
if( m_Menu.IsTransitioning() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
switch( SM )
|
||||||
|
{
|
||||||
|
case SM_GoToNextScreen:
|
||||||
|
case SM_GoToPrevScreen:
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::ChangeValue( int iDirection )
|
||||||
|
{
|
||||||
|
tm now = GetLocalTime();
|
||||||
|
switch( m_Selection )
|
||||||
|
{
|
||||||
|
case hour: now.tm_hour += iDirection; break;
|
||||||
|
case minute: now.tm_min += iDirection; break;
|
||||||
|
case second: now.tm_sec += iDirection; break;
|
||||||
|
case year: now.tm_year += iDirection; break;
|
||||||
|
case month: now.tm_mon += iDirection; break;
|
||||||
|
case day: now.tm_mday += iDirection; break;
|
||||||
|
default: ASSERT(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
HOOKS->SetTime( now );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::ChangeSelection( int iDirection )
|
||||||
|
{
|
||||||
|
// turn off old effect
|
||||||
|
m_text[m_Selection].SetEffectNone();
|
||||||
|
|
||||||
|
// set new value of m_Selection
|
||||||
|
((int&)m_Selection) += iDirection;
|
||||||
|
CLAMP( (int&)m_Selection, 0, NUM_SELECTIONS-1 );
|
||||||
|
|
||||||
|
m_text[m_Selection].SetEffectDiffuseShift();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuUp( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ChangeSelection( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuDown( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ChangeSelection( +1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuLeft( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ChangeValue( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuRight( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ChangeValue( +1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
m_Menu.StartTransitioning( SM_GoToNextScreen );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSetTime::MenuBack( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
m_Menu.StartTransitioning( SM_GoToPrevScreen );
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenSetTime
|
||||||
|
|
||||||
|
Desc: Show coin drop stats.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Screen.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
|
#include "MenuElements.h"
|
||||||
|
#include "RageInputDevice.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ScreenSetTime : public Screen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenSetTime( CString sName );
|
||||||
|
|
||||||
|
virtual void Update( float fDelta );
|
||||||
|
virtual void DrawPrimitives();
|
||||||
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
virtual void MenuUp( PlayerNumber pn );
|
||||||
|
virtual void MenuDown( PlayerNumber pn );
|
||||||
|
virtual void MenuLeft( PlayerNumber pn );
|
||||||
|
virtual void MenuRight( PlayerNumber pn );
|
||||||
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum Selection { hour, minute, second, year, month, day, NUM_SELECTIONS } m_Selection;
|
||||||
|
void ChangeSelection( int iDirection );
|
||||||
|
void ChangeValue( int iDirection );
|
||||||
|
|
||||||
|
BitmapText m_text[NUM_SELECTIONS];
|
||||||
|
BitmapText m_textDayOfWeek;
|
||||||
|
|
||||||
|
MenuElements m_Menu;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -5663,6 +5663,25 @@ SOURCE=.\ScreenSelectStyle.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ScreenSetTime.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ScreenSetTime.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\ScreenSongOptions.cpp
|
SOURCE=.\ScreenSongOptions.cpp
|
||||||
|
|
||||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||||
|
|||||||
@@ -472,6 +472,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ScreenSelectStyle.h">
|
RelativePath="ScreenSelectStyle.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenSetTime.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenSetTime.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenSongOptions.cpp">
|
RelativePath="ScreenSongOptions.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
virtual void EnterTimeCriticalSection() { }
|
virtual void EnterTimeCriticalSection() { }
|
||||||
virtual void ExitTimeCriticalSection() { }
|
virtual void ExitTimeCriticalSection() { }
|
||||||
|
|
||||||
|
virtual void SetTime( tm newtime ) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void MessageBoxErrorPrivate( CString sMessage, CString ID ) { printf("Error: %s\n", sMessage.c_str()); }
|
virtual void MessageBoxErrorPrivate( CString sMessage, CString ID ) { printf("Error: %s\n", sMessage.c_str()); }
|
||||||
virtual void MessageBoxOKPrivate( CString sMessage, CString ID ) {}
|
virtual void MessageBoxOKPrivate( CString sMessage, CString ID ) {}
|
||||||
|
|||||||
@@ -202,6 +202,20 @@ void ArchHooks_Win32::ExitTimeCriticalSection()
|
|||||||
TimeCritMutex->Unlock();
|
TimeCritMutex->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArchHooks_Win32::SetTime( tm newtime )
|
||||||
|
{
|
||||||
|
SYSTEMTIME st;
|
||||||
|
ZERO( st );
|
||||||
|
st.wYear = newtime.tm_year+1900;
|
||||||
|
st.wMonth = newtime.tm_mon+1;
|
||||||
|
st.wDay = newtime.tm_mday;
|
||||||
|
st.wHour = newtime.tm_hour;
|
||||||
|
st.wMinute = newtime.tm_min;
|
||||||
|
st.wSecond = newtime.tm_sec;
|
||||||
|
st.wMilliseconds = 0;
|
||||||
|
BOOL b = SetLocalTime( &st );
|
||||||
|
DWORD dw = GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2004 by the person(s) listed below. All rights reserved.
|
* Copyright (c) 2002-2004 by the person(s) listed below. All rights reserved.
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public:
|
|||||||
RageMutex *TimeCritMutex;
|
RageMutex *TimeCritMutex;
|
||||||
void EnterTimeCriticalSection();
|
void EnterTimeCriticalSection();
|
||||||
void ExitTimeCriticalSection();
|
void ExitTimeCriticalSection();
|
||||||
|
void SetTime( tm newtime );
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef ARCH_HOOKS
|
#undef ARCH_HOOKS
|
||||||
|
|||||||
Reference in New Issue
Block a user