Add a virtual keyboard to ScreenTextEntry
This commit is contained in:
@@ -1 +1 @@
|
|||||||
_prompt in normal
|
_prompt in instant
|
||||||
|
|||||||
@@ -4398,3 +4398,18 @@ Fallback=ScreenMiniMenu
|
|||||||
[ScreenMiniMenuCourseOptions]
|
[ScreenMiniMenuCourseOptions]
|
||||||
Fallback=ScreenMiniMenu
|
Fallback=ScreenMiniMenu
|
||||||
|
|
||||||
|
[ScreenTextEntry]
|
||||||
|
QuestionX=SCREEN_CENTER_X
|
||||||
|
QuestionY=SCREEN_CENTER_Y-150
|
||||||
|
QuestionOnCommand=
|
||||||
|
QuestionOffCommand=
|
||||||
|
AnswerBoxX=SCREEN_CENTER_X
|
||||||
|
AnswerBoxY=SCREEN_CENTER_Y-100
|
||||||
|
AnswerBoxOnCommand=
|
||||||
|
AnswerBoxOffCommand=
|
||||||
|
AnswerX=SCREEN_CENTER_X
|
||||||
|
AnswerY=SCREEN_CENTER_Y-100
|
||||||
|
AnswerOnCommand=
|
||||||
|
AnswerOffCommand=
|
||||||
|
CursorOnCommand=
|
||||||
|
CursorOffCommand=
|
||||||
@@ -90,8 +90,6 @@ StyleInput.h TimingData.cpp TimingData.h \
|
|||||||
ThemeMetric.h \
|
ThemeMetric.h \
|
||||||
Trail.cpp Trail.h TrailUtil.cpp TrailUtil.h TitleSubstitution.cpp TitleSubstitution.h
|
Trail.cpp Trail.h TrailUtil.cpp TrailUtil.h TitleSubstitution.cpp TitleSubstitution.h
|
||||||
|
|
||||||
VirtualKeyboard = VirtualKeyboard.cpp VirtualKeyboard.h
|
|
||||||
|
|
||||||
FileTypes = IniFile.cpp IniFile.h \
|
FileTypes = IniFile.cpp IniFile.h \
|
||||||
MsdFile.cpp MsdFile.h \
|
MsdFile.cpp MsdFile.h \
|
||||||
XmlFile.cpp XmlFile.h
|
XmlFile.cpp XmlFile.h
|
||||||
@@ -338,7 +336,6 @@ CryptHelpers.cpp CryptHelpers.h
|
|||||||
|
|
||||||
main_SOURCES = $(Screens) \
|
main_SOURCES = $(Screens) \
|
||||||
$(DataStructures) \
|
$(DataStructures) \
|
||||||
$(VirtualKeyboard) \
|
|
||||||
$(FileTypes) \
|
$(FileTypes) \
|
||||||
$(StepMania) \
|
$(StepMania) \
|
||||||
$(Arch) \
|
$(Arch) \
|
||||||
|
|||||||
@@ -319,10 +319,7 @@ void PrefsManager::Init()
|
|||||||
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
||||||
m_iProductID = 1;
|
m_iProductID = 1;
|
||||||
|
|
||||||
m_bEnableVirtualKeyboard = false;
|
|
||||||
|
|
||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
m_bEnableVirtualKeyboard = true;
|
|
||||||
m_bEnableVirtualMemory = true;
|
m_bEnableVirtualMemory = true;
|
||||||
m_iPageFileSize = 384;
|
m_iPageFileSize = 384;
|
||||||
m_iPageSize = 16;
|
m_iPageSize = 16;
|
||||||
@@ -532,8 +529,6 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
|
|||||||
FixSlashesInPlace(m_sAdditionalSongFolders);
|
FixSlashesInPlace(m_sAdditionalSongFolders);
|
||||||
FixSlashesInPlace(m_sAdditionalFolders);
|
FixSlashesInPlace(m_sAdditionalFolders);
|
||||||
|
|
||||||
ini.GetValue( "Options", "EnableVirtualKeyboard", m_bEnableVirtualKeyboard );
|
|
||||||
|
|
||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
ini.GetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
|
ini.GetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
|
||||||
ini.GetValue( "Options", "PageFileSize", m_iPageFileSize );
|
ini.GetValue( "Options", "PageFileSize", m_iPageFileSize );
|
||||||
@@ -766,8 +761,6 @@ void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const
|
|||||||
ini.SetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders);
|
ini.SetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders);
|
||||||
ini.SetValue( "Options", "AdditionalFolders", m_sAdditionalFolders);
|
ini.SetValue( "Options", "AdditionalFolders", m_sAdditionalFolders);
|
||||||
|
|
||||||
ini.SetValue( "Options", "EnableVirtualKeyboard", m_bEnableVirtualKeyboard );
|
|
||||||
|
|
||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
ini.SetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
|
ini.SetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
|
||||||
ini.SetValue( "Options", "PageFileSize", m_iPageFileSize );
|
ini.SetValue( "Options", "PageFileSize", m_iPageFileSize );
|
||||||
|
|||||||
@@ -278,9 +278,6 @@ public:
|
|||||||
/* Game-specific prefs: */
|
/* Game-specific prefs: */
|
||||||
CString m_sDefaultModifiers;
|
CString m_sDefaultModifiers;
|
||||||
|
|
||||||
// Virtual keyboard
|
|
||||||
bool m_bEnableVirtualKeyboard;
|
|
||||||
|
|
||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
// Virtual memory preferences
|
// Virtual memory preferences
|
||||||
bool m_bEnableVirtualMemory;
|
bool m_bEnableVirtualMemory;
|
||||||
|
|||||||
@@ -194,46 +194,35 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
|
|||||||
break;
|
break;
|
||||||
case EDIT_MENU_ACTION_COPY:
|
case EDIT_MENU_ACTION_COPY:
|
||||||
case EDIT_MENU_ACTION_AUTOGEN:
|
case EDIT_MENU_ACTION_AUTOGEN:
|
||||||
ASSERT( !pSteps );
|
|
||||||
ASSERT( pSourceSteps );
|
|
||||||
{
|
|
||||||
// Yuck. Doing the memory allocation doesn't seem right since
|
|
||||||
// Song allocates all of the other Steps.
|
|
||||||
pSteps = new Steps;
|
|
||||||
switch( action )
|
|
||||||
{
|
|
||||||
case EDIT_MENU_ACTION_COPY:
|
|
||||||
pSteps->CopyFrom( pSourceSteps, st );
|
|
||||||
break;
|
|
||||||
case EDIT_MENU_ACTION_AUTOGEN:
|
|
||||||
pSteps->AutogenFrom( pSourceSteps, st );
|
|
||||||
pSteps->DeAutogen();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
pSteps->SetDifficulty( dc ); // override difficulty with the user's choice
|
|
||||||
CString sEditName = GetCopyDescription(pSourceSteps);
|
|
||||||
pSong->MakeUniqueEditDescription( st, sEditName );
|
|
||||||
pSteps->SetDescription( sEditName );
|
|
||||||
pSong->AddSteps( pSteps );
|
|
||||||
|
|
||||||
SCREENMAN->PlayStartSound();
|
|
||||||
|
|
||||||
GAMESTATE->m_pCurSong.Set( pSong );
|
|
||||||
GAMESTATE->m_pCurSteps[0].Set( pSteps );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EDIT_MENU_ACTION_BLANK:
|
case EDIT_MENU_ACTION_BLANK:
|
||||||
ASSERT( !pSteps );
|
ASSERT( !pSteps );
|
||||||
{
|
{
|
||||||
// Yuck. Doing the memory allocation doesn't seem right since
|
// Yuck. Doing the memory allocation doesn't seem right since
|
||||||
// Song allocates all of the other Steps.
|
// Song allocates all of the other Steps.
|
||||||
pSteps = new Steps;
|
pSteps = new Steps;
|
||||||
pSteps->CreateBlank( st );
|
CString sEditName;
|
||||||
pSteps->SetDifficulty( dc );
|
switch( action )
|
||||||
pSteps->SetMeter( 1 );
|
{
|
||||||
CString sEditName = "Blank";
|
case EDIT_MENU_ACTION_COPY:
|
||||||
|
ASSERT( pSourceSteps );
|
||||||
|
pSteps->CopyFrom( pSourceSteps, st );
|
||||||
|
sEditName = GetCopyDescription(pSourceSteps);
|
||||||
|
break;
|
||||||
|
case EDIT_MENU_ACTION_AUTOGEN:
|
||||||
|
ASSERT( pSourceSteps );
|
||||||
|
pSteps->AutogenFrom( pSourceSteps, st );
|
||||||
|
pSteps->DeAutogen();
|
||||||
|
sEditName = GetCopyDescription(pSourceSteps);
|
||||||
|
break;
|
||||||
|
case EDIT_MENU_ACTION_BLANK:
|
||||||
|
pSteps->CreateBlank( st );
|
||||||
|
pSteps->SetMeter( 1 );
|
||||||
|
sEditName = "Blank";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
pSteps->SetDifficulty( dc ); // override difficulty with the user's choice
|
||||||
pSong->MakeUniqueEditDescription( st, sEditName );
|
pSong->MakeUniqueEditDescription( st, sEditName );
|
||||||
pSteps->SetDescription( sEditName );
|
pSteps->SetDescription( sEditName );
|
||||||
pSong->AddSteps( pSteps );
|
pSong->AddSteps( pSteps );
|
||||||
@@ -262,7 +251,8 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
|
|||||||
ASSERT( pSteps );
|
ASSERT( pSteps );
|
||||||
SOUND->StopMusic();
|
SOUND->StopMusic();
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
StartTransitioning( SM_GoToNextScreen );
|
//StartTransitioning( SM_GoToNextScreen );
|
||||||
|
SCREENMAN->TextEntry( SM_None, "Testing", "");
|
||||||
break;
|
break;
|
||||||
case EDIT_MENU_ACTION_DELETE:
|
case EDIT_MENU_ACTION_DELETE:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
|
||||||
#define TITLEBG_WIDTH THEME->GetMetricF(m_sName,"TitleBGWidth")
|
#define TITLEBG_WIDTH THEME->GetMetricF(m_sName,"TitleBGWidth")
|
||||||
@@ -144,14 +143,15 @@ void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SM_BackFromRoomName:
|
case SM_BackFromRoomName:
|
||||||
if ( !ScreenTextEntry::s_bCancelledLast ) {
|
if ( !ScreenTextEntry::s_bCancelledLast )
|
||||||
|
{
|
||||||
m_newRoomName = ScreenTextEntry::s_sLastAnswer;
|
m_newRoomName = ScreenTextEntry::s_sLastAnswer;
|
||||||
VIRTUALKB.Reset(VKMODE_PROFILE); // allow all characters
|
|
||||||
SCREENMAN->TextEntry( SM_BackFromRoomDesc, "Enter Room Description:", "");
|
SCREENMAN->TextEntry( SM_BackFromRoomDesc, "Enter Room Description:", "");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SM_BackFromRoomDesc:
|
case SM_BackFromRoomDesc:
|
||||||
if ( !ScreenTextEntry::s_bCancelledLast ) {
|
if ( !ScreenTextEntry::s_bCancelledLast )
|
||||||
|
{
|
||||||
m_newRoomDesc = ScreenTextEntry::s_sLastAnswer;
|
m_newRoomDesc = ScreenTextEntry::s_sLastAnswer;
|
||||||
CreateNewRoom( m_newRoomName, m_newRoomDesc);
|
CreateNewRoom( m_newRoomName, m_newRoomDesc);
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,6 @@ void ScreenNetRoom::MenuStart( PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SelectMakeRoom:
|
case SelectMakeRoom:
|
||||||
VIRTUALKB.Reset(VKMODE_PROFILE); // allow all characters
|
|
||||||
SCREENMAN->TextEntry( SM_BackFromRoomName, "Enter Room Name:", "");
|
SCREENMAN->TextEntry( SM_BackFromRoomName, "Enter Room Name:", "");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "NetworkSyncServer.h"
|
#include "NetworkSyncServer.h"
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PO_CONNECTION,
|
PO_CONNECTION,
|
||||||
@@ -123,10 +122,10 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
case PO_CONNECTION:
|
case PO_CONNECTION:
|
||||||
if ( !NSMAN->useSMserver )
|
if ( !NSMAN->useSMserver )
|
||||||
{
|
{
|
||||||
VIRTUALKB.Reset(VKMODE_IP);
|
|
||||||
SCREENMAN->TextEntry( SM_DoneConnecting, "Enter a Network Address\n127.0.0.1 to connect to yourself", g_sLastServer );
|
SCREENMAN->TextEntry( SM_DoneConnecting, "Enter a Network Address\n127.0.0.1 to connect to yourself", g_sLastServer );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
NSMAN->CloseConnection();
|
NSMAN->CloseConnection();
|
||||||
SCREENMAN->SystemMessage("Disconnected from server.");
|
SCREENMAN->SystemMessage("Disconnected from server.");
|
||||||
UpdateConnectStatus( );
|
UpdateConnectStatus( );
|
||||||
@@ -138,7 +137,6 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
case NO_START_SERVER:
|
case NO_START_SERVER:
|
||||||
if (!NSMAN->isLanServer)
|
if (!NSMAN->isLanServer)
|
||||||
{
|
{
|
||||||
VIRTUALKB.Reset(VKMODE_PROFILE);
|
|
||||||
SCREENMAN->TextEntry( SM_ServerNameEnter, "Enter a server name...", "", NULL );
|
SCREENMAN->TextEntry( SM_ServerNameEnter, "Enter a server name...", "", NULL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#define EXISTINGBG_WIDTH THEME->GetMetricF(m_sName,"PackagesBGWidth")
|
#define EXISTINGBG_WIDTH THEME->GetMetricF(m_sName,"PackagesBGWidth")
|
||||||
@@ -165,14 +164,9 @@ void ScreenPackages::MenuStart( PlayerNumber pn )
|
|||||||
if ( m_iDLorLST == 1 )
|
if ( m_iDLorLST == 1 )
|
||||||
{
|
{
|
||||||
if ( m_iLinksPos == 0 )
|
if ( m_iLinksPos == 0 )
|
||||||
{
|
|
||||||
VIRTUALKB.Reset(VKMODE_PROFILE); // allow all characters
|
|
||||||
SCREENMAN->TextEntry( SM_BackFromURL, "Enter URL:", "http://" );
|
SCREENMAN->TextEntry( SM_BackFromURL, "Enter URL:", "http://" );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
EnterURL( m_Links[m_iLinksPos] );
|
EnterURL( m_Links[m_iLinksPos] );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ScreenWithMenuElements::MenuStart( pn );
|
ScreenWithMenuElements::MenuStart( pn );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -197,9 +196,6 @@ void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
switch( GetCurrentRow() )
|
switch( GetCurrentRow() )
|
||||||
{
|
{
|
||||||
case PO_CREATE_NEW:
|
case PO_CREATE_NEW:
|
||||||
|
|
||||||
VIRTUALKB.Reset(VKMODE_PROFILE); // set the xbox virtual keyboard to profile mode
|
|
||||||
|
|
||||||
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
||||||
break;
|
break;
|
||||||
case PO_DELETE_:
|
case PO_DELETE_:
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "NetworkSyncManager.h"
|
#include "NetworkSyncManager.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
|
|||||||
+241
-119
@@ -8,16 +8,22 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "FontCharAliases.h"
|
#include "FontCharAliases.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "VirtualKeyboard.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
#define QUESTION_X (SCREEN_CENTER_X)
|
const SPECIAL_KEY_WIDTH = 3; // special keys are 3x as wide as normal keys
|
||||||
#define QUESTION_Y (SCREEN_CENTER_Y - 60)
|
|
||||||
|
|
||||||
#define ANSWER_X (SCREEN_CENTER_X)
|
|
||||||
#define ANSWER_Y (SCREEN_CENTER_Y + 120)
|
|
||||||
#define ANSWER_WIDTH (440)
|
|
||||||
#define ANSWER_HEIGHT (30)
|
|
||||||
|
|
||||||
|
const int MAX_KEYS_PER_ROW = 13;
|
||||||
|
|
||||||
|
float GetButtonX( int x )
|
||||||
|
{
|
||||||
|
return roundf( SCALE( x, 0, MAX_KEYS_PER_ROW-1, SCREEN_LEFT+100, SCREEN_RIGHT-100 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetButtonY( KeyboardRow r )
|
||||||
|
{
|
||||||
|
return roundf( SCALE( r, 0, NUM_KEYBOARD_ROWS-1, SCREEN_CENTER_Y, SCREEN_BOTTOM-100 ) );
|
||||||
|
}
|
||||||
|
|
||||||
CString ScreenTextEntry::s_sLastAnswer = "";
|
CString ScreenTextEntry::s_sLastAnswer = "";
|
||||||
bool ScreenTextEntry::s_bCancelledLast = false;
|
bool ScreenTextEntry::s_bCancelledLast = false;
|
||||||
@@ -34,13 +40,15 @@ bool ScreenTextEntry::s_bCancelledLast = false;
|
|||||||
ScreenTextEntry::ScreenTextEntry( CString sClassName, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer), void(*OnCancel)(), bool bPassword ) :
|
ScreenTextEntry::ScreenTextEntry( CString sClassName, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer), void(*OnCancel)(), bool bPassword ) :
|
||||||
Screen( sClassName )
|
Screen( sClassName )
|
||||||
{
|
{
|
||||||
|
m_sName = "ScreenTextEntry";
|
||||||
|
|
||||||
m_bIsTransparent = true; // draw screens below us
|
m_bIsTransparent = true; // draw screens below us
|
||||||
m_bPassword = bPassword;
|
m_bPassword = bPassword;
|
||||||
|
|
||||||
m_pOnOK = OnOK;
|
m_pOnOK = OnOK;
|
||||||
m_pOnCancel = OnCancel;
|
m_pOnCancel = OnCancel;
|
||||||
|
|
||||||
m_sAnswer = CStringToWstring(sInitialAnswer);
|
m_sAnswer = CStringToWstring( sInitialAnswer );
|
||||||
m_bCancelled = false;
|
m_bCancelled = false;
|
||||||
|
|
||||||
m_sQuestion = sQuestion;
|
m_sQuestion = sQuestion;
|
||||||
@@ -48,46 +56,146 @@ ScreenTextEntry::ScreenTextEntry( CString sClassName, CString sQuestion, CString
|
|||||||
|
|
||||||
void ScreenTextEntry::Init()
|
void ScreenTextEntry::Init()
|
||||||
{
|
{
|
||||||
m_Background.LoadFromAniDir( THEME->GetPathB("ScreenPrompt","background") );
|
m_Background.Load( THEME->GetPathB(m_sName,"background") );
|
||||||
this->AddChild( &m_Background );
|
m_Background->SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING );
|
||||||
|
this->AddChild( m_Background );
|
||||||
|
m_Background->PlayCommand( "On" );
|
||||||
|
|
||||||
m_textQuestion.LoadFromFont( THEME->GetPathF("Common","normal") );
|
m_textQuestion.LoadFromFont( THEME->GetPathF(m_sName,"question") );
|
||||||
|
m_textQuestion.SetName( "Question" );
|
||||||
m_textQuestion.SetText( m_sQuestion );
|
m_textQuestion.SetText( m_sQuestion );
|
||||||
m_textQuestion.SetXY( QUESTION_X, QUESTION_Y );
|
SET_XY_AND_ON_COMMAND( m_textQuestion );
|
||||||
this->AddChild( &m_textQuestion );
|
this->AddChild( &m_textQuestion );
|
||||||
|
|
||||||
m_rectAnswerBox.SetDiffuse( RageColor(0.5f,0.5f,1.0f,0.7f) );
|
m_sprAnswerBox.Load( THEME->GetPathG(m_sName,"AnswerBox") );
|
||||||
m_rectAnswerBox.SetXY( ANSWER_X, ANSWER_Y );
|
m_sprAnswerBox->SetName( "AnswerBox" );
|
||||||
m_rectAnswerBox.SetZoomX( ANSWER_WIDTH );
|
SET_XY_AND_ON_COMMAND( m_sprAnswerBox );
|
||||||
m_rectAnswerBox.SetZoomY( ANSWER_HEIGHT );
|
this->AddChild( m_sprAnswerBox );
|
||||||
this->AddChild( &m_rectAnswerBox );
|
|
||||||
|
|
||||||
m_textAnswer.LoadFromFont( THEME->GetPathF("Common","title") );
|
m_textAnswer.LoadFromFont( THEME->GetPathF(m_sName,"answer") );
|
||||||
m_textAnswer.SetXY( ANSWER_X, ANSWER_Y );
|
m_textAnswer.SetName( "Answer" );
|
||||||
UpdateText();
|
SET_XY_AND_ON_COMMAND( m_textAnswer );
|
||||||
|
UpdateAnswerText();
|
||||||
this->AddChild( &m_textAnswer );
|
this->AddChild( &m_textAnswer );
|
||||||
|
|
||||||
m_In.Load( THEME->GetPathB("ScreenPrompt","in") );
|
|
||||||
|
m_sprCursor.Load( THEME->GetPathG(m_sName,"cursor") );
|
||||||
|
m_sprCursor->SetName( "Cursor" );
|
||||||
|
ON_COMMAND( m_sprCursor );
|
||||||
|
this->AddChild( m_sprCursor );
|
||||||
|
|
||||||
|
m_iFocusX = 0;
|
||||||
|
m_iFocusY = (KeyboardRow)0;
|
||||||
|
|
||||||
|
|
||||||
|
// Fill in m_Keys
|
||||||
|
{
|
||||||
|
static const char* g_szKeys[NUM_KEYBOARD_CASES][NUM_KEYBOARD_ROWS][MAX_KEYS_PER_ROW+1] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{"`","1","2","3","4","5","6","7","8","9","0","-","=",NULL},
|
||||||
|
{"q","w","e","r","t","y","u","i","o","p","[","]","\\",NULL},
|
||||||
|
{"a","s","d","f","g","h","j","k","l",";","\"",NULL},
|
||||||
|
{"z","x","c","v","b","n","m",",",".","/",NULL},
|
||||||
|
{"Caps","Space","Backsp","Done",NULL}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{"~","!","@","#","$","%","^","&","*","(",")","_","+",NULL},
|
||||||
|
{"Q","W","E","R","T","Y","U","I","O","P","{","}","|",NULL},
|
||||||
|
{"A","S","D","F","G","H","J","K","L",":","'",NULL},
|
||||||
|
{"Z","X","C","V","B","N","M","<",">","?",NULL},
|
||||||
|
{"CAPS","Space","Backsp","Done",NULL}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FOREACH_KeyboardCase( k )
|
||||||
|
{
|
||||||
|
FOREACH_KeyboardRow( r )
|
||||||
|
{
|
||||||
|
for( int x=0; true; x++ )
|
||||||
|
{
|
||||||
|
const char *c=g_szKeys[LOWERCASE][r][x];
|
||||||
|
if( c == NULL )
|
||||||
|
break;
|
||||||
|
m_Keys[k][r].push_back( c );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT_M( m_Keys[k][r].size() == m_Keys[0][r].size(), "uppercase and lowercase sizes don't match" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init keyboard
|
||||||
|
FOREACH_KeyboardRow( r )
|
||||||
|
{
|
||||||
|
vector<BitmapText*> &v = m_textKeyboardChars[r];
|
||||||
|
const CStringArray &vKeys = m_Keys[LOWERCASE][r];
|
||||||
|
for( unsigned x=0; x<vKeys.size(); x++ )
|
||||||
|
{
|
||||||
|
BitmapText *p = new BitmapText;
|
||||||
|
p->LoadFromFont( THEME->GetPathF(m_sName,"keyboard") );
|
||||||
|
p->SetXY( GetButtonX(x), GetButtonY(r) );
|
||||||
|
v.push_back( p );
|
||||||
|
this->AddChild( p );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateKeyboardText();
|
||||||
|
|
||||||
|
PositionCursor();
|
||||||
|
|
||||||
|
m_In.Load( THEME->GetPathB(m_sName,"in") );
|
||||||
m_In.StartTransitioning();
|
m_In.StartTransitioning();
|
||||||
this->AddChild( &m_In );
|
this->AddChild( &m_In );
|
||||||
|
|
||||||
m_Out.Load( THEME->GetPathB("ScreenPrompt","out") );
|
m_Out.Load( THEME->GetPathB(m_sName,"out") );
|
||||||
this->AddChild( &m_Out );
|
this->AddChild( &m_Out );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::UpdateText()
|
ScreenTextEntry::~ScreenTextEntry()
|
||||||
|
{
|
||||||
|
for( int i=0; i<NUM_KEYBOARD_ROWS; i++ )
|
||||||
|
{
|
||||||
|
FOREACH( BitmapText*, m_textKeyboardChars[i], p )
|
||||||
|
SAFE_DELETE(*p);
|
||||||
|
m_textKeyboardChars[i].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenTextEntry::UpdateKeyboardText()
|
||||||
|
{
|
||||||
|
FOREACH_KeyboardRow( r )
|
||||||
|
{
|
||||||
|
vector<BitmapText*> &v = m_textKeyboardChars[r];
|
||||||
|
const CStringArray &vKeys = m_Keys[LOWERCASE][r];
|
||||||
|
for( unsigned x=0; x<vKeys.size(); x++ )
|
||||||
|
{
|
||||||
|
BitmapText *p = v[x];
|
||||||
|
p->SetText( vKeys[x] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenTextEntry::UpdateAnswerText()
|
||||||
{
|
{
|
||||||
CString txt = WStringToCString(m_sAnswer);
|
CString txt = WStringToCString(m_sAnswer);
|
||||||
if(m_bPassword) {
|
if( m_bPassword )
|
||||||
int len = txt.GetLength();
|
{
|
||||||
txt = "";
|
int len = txt.GetLength();
|
||||||
for(int i=0;i<len;++i)
|
txt = "";
|
||||||
txt += "*";
|
for( int i=0; i<len; ++i )
|
||||||
|
txt += "*";
|
||||||
}
|
}
|
||||||
FontCharAliases::ReplaceMarkers(txt);
|
FontCharAliases::ReplaceMarkers(txt);
|
||||||
m_textAnswer.SetText( txt );
|
m_textAnswer.SetText( txt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenTextEntry::PositionCursor()
|
||||||
|
{
|
||||||
|
BitmapText *p = m_textKeyboardChars[m_iFocusY][m_iFocusX];
|
||||||
|
m_sprCursor->SetXY( p->GetX(), p->GetY() );
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::Update( float fDeltaTime )
|
void ScreenTextEntry::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Screen::Update( fDeltaTime );
|
Screen::Update( fDeltaTime );
|
||||||
@@ -106,95 +214,74 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
if( type != IET_FIRST_PRESS )
|
if( type != IET_FIRST_PRESS )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int button = DeviceI.button;
|
if( !MenuI.IsValid() )
|
||||||
|
|
||||||
if(PREFSMAN->m_bEnableVirtualKeyboard)
|
|
||||||
{
|
{
|
||||||
bool nextChar = false;
|
switch( DeviceI.button )
|
||||||
|
|
||||||
wchar_t toAdd = VIRTUALKB.Translate(DeviceI, MenuI, m_sAnswer, &nextChar);
|
|
||||||
|
|
||||||
if( toAdd != 0 && toAdd != KEY_BACK && toAdd != KEY_ESC && toAdd != KEY_ENTER )
|
|
||||||
{
|
{
|
||||||
if(!nextChar)
|
case KEY_ESC:
|
||||||
|
m_bCancelled = true;
|
||||||
|
End();
|
||||||
|
break;
|
||||||
|
case KEY_ENTER:
|
||||||
|
case KEY_KP_ENTER:
|
||||||
|
End();
|
||||||
|
break;
|
||||||
|
case KEY_BACK:
|
||||||
|
if(!m_sAnswer.empty())
|
||||||
|
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
||||||
|
UpdateAnswerText();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
char c = DeviceI.ToChar();
|
||||||
|
|
||||||
|
bool bHoldingShift =
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) ||
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT));
|
||||||
|
|
||||||
|
// International keyboards often have other keys mapped to shifted keys, and always
|
||||||
|
// using a US layout is a bit gimped. This is better than nothing though.
|
||||||
|
if( bHoldingShift )
|
||||||
{
|
{
|
||||||
if(!m_sAnswer.empty())
|
c = (char)toupper(c);
|
||||||
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
|
||||||
|
switch( c )
|
||||||
|
{
|
||||||
|
case '`': c='~'; break;
|
||||||
|
case '1': c='!'; break;
|
||||||
|
case '2': c='@'; break;
|
||||||
|
case '3': c='#'; break;
|
||||||
|
case '4': c='$'; break;
|
||||||
|
case '5': c='%'; break;
|
||||||
|
case '6': c='^'; break;
|
||||||
|
case '7': c='&'; break;
|
||||||
|
case '8': c='*'; break;
|
||||||
|
case '9': c='('; break;
|
||||||
|
case '0': c=')'; break;
|
||||||
|
case '-': c='_'; break;
|
||||||
|
case '=': c='+'; break;
|
||||||
|
case '[': c='{'; break;
|
||||||
|
case ']': c='}'; break;
|
||||||
|
case '\\': c='|'; break;
|
||||||
|
case ';': c=':'; break;
|
||||||
|
case '\'': c='"'; break;
|
||||||
|
case ',': c='<'; break;
|
||||||
|
case '.': c='>'; break;
|
||||||
|
case '/': c='?'; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sAnswer += toAdd;
|
if( c >= ' ' )
|
||||||
|
|
||||||
UpdateText();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
button = toAdd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch( button )
|
|
||||||
{
|
|
||||||
case KEY_ESC:
|
|
||||||
m_bCancelled = true;
|
|
||||||
MenuStart(PLAYER_1);
|
|
||||||
break;
|
|
||||||
case KEY_ENTER:
|
|
||||||
case KEY_KP_ENTER:
|
|
||||||
MenuStart(PLAYER_1);
|
|
||||||
break;
|
|
||||||
case KEY_BACK:
|
|
||||||
if(!m_sAnswer.empty())
|
|
||||||
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
|
||||||
UpdateText();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
char c;
|
|
||||||
|
|
||||||
c = DeviceI.ToChar();
|
|
||||||
|
|
||||||
bool bHoldingShift =
|
|
||||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) ||
|
|
||||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT));
|
|
||||||
|
|
||||||
// International keyboards often have other keys mapped to shifted keys, and always
|
|
||||||
// using a US layout is a bit gimped. This is better than nothing though.
|
|
||||||
if( bHoldingShift )
|
|
||||||
{
|
|
||||||
c = (char)toupper(c);
|
|
||||||
|
|
||||||
switch( c )
|
|
||||||
{
|
{
|
||||||
case '`': c='~'; break;
|
m_sAnswer += c;
|
||||||
case '1': c='!'; break;
|
UpdateAnswerText();
|
||||||
case '2': c='@'; break;
|
|
||||||
case '3': c='#'; break;
|
|
||||||
case '4': c='$'; break;
|
|
||||||
case '5': c='%'; break;
|
|
||||||
case '6': c='^'; break;
|
|
||||||
case '7': c='&'; break;
|
|
||||||
case '8': c='*'; break;
|
|
||||||
case '9': c='('; break;
|
|
||||||
case '0': c=')'; break;
|
|
||||||
case '-': c='_'; break;
|
|
||||||
case '=': c='+'; break;
|
|
||||||
case '[': c='{'; break;
|
|
||||||
case ']': c='}'; break;
|
|
||||||
case '\\': c='|'; break;
|
|
||||||
case ';': c=':'; break;
|
|
||||||
case '\'': c='"'; break;
|
|
||||||
case ',': c='<'; break;
|
|
||||||
case '.': c='>'; break;
|
|
||||||
case '/': c='?'; break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( c >= ' ' )
|
return; // don't let Screen::Input handle
|
||||||
{
|
|
||||||
m_sAnswer += c;
|
|
||||||
UpdateText();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenTextEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||||
@@ -213,28 +300,63 @@ void ScreenTextEntry::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::MenuLeft( PlayerNumber pn )
|
void ScreenTextEntry::MoveX( int iDir )
|
||||||
{
|
{
|
||||||
|
m_iFocusX += iDir;
|
||||||
|
wrap( m_iFocusX, m_Keys[LOWERCASE][m_iFocusY].size() );
|
||||||
|
|
||||||
|
PositionCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::MenuRight( PlayerNumber pn )
|
void ScreenTextEntry::MoveY( int iDir )
|
||||||
{
|
{
|
||||||
|
m_iFocusY = (KeyboardRow)(m_iFocusY + iDir);
|
||||||
|
wrap( (int&)m_iFocusY, NUM_KEYBOARD_ROWS );
|
||||||
|
CLAMP( m_iFocusX, 0, (int)m_Keys[LOWERCASE][m_iFocusY].size()-1 );
|
||||||
|
|
||||||
|
PositionCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTextEntry::MenuStart( PlayerNumber pn )
|
void ScreenTextEntry::MenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
if( m_iFocusY == KEYBOARD_ROW_SPECIAL )
|
||||||
|
{
|
||||||
|
switch( m_iFocusX )
|
||||||
|
{
|
||||||
|
case CAPS:
|
||||||
|
break;
|
||||||
|
case SPACEBAR:
|
||||||
|
m_sAnswer += CStringToWstring( " " );
|
||||||
|
UpdateAnswerText();
|
||||||
|
break;
|
||||||
|
case BACKSPACE:
|
||||||
|
m_sAnswer.erase( m_sAnswer.end()-1 );
|
||||||
|
UpdateAnswerText();
|
||||||
|
break;
|
||||||
|
case DONE:
|
||||||
|
End();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_sAnswer += CStringToWstring( m_Keys[LOWERCASE][m_iFocusY][m_iFocusX] );
|
||||||
|
UpdateAnswerText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenTextEntry::End()
|
||||||
{
|
{
|
||||||
m_Out.StartTransitioning( SM_DoneOpeningWipingRight );
|
m_Out.StartTransitioning( SM_DoneOpeningWipingRight );
|
||||||
|
|
||||||
m_textQuestion.BeginTweening( 0.2f );
|
m_Background->PlayCommand("Off");
|
||||||
m_textQuestion.SetDiffuse( RageColor(1,1,1,0) );
|
|
||||||
|
|
||||||
m_rectAnswerBox.BeginTweening( 0.2f );
|
OFF_COMMAND( m_textQuestion );
|
||||||
m_rectAnswerBox.SetDiffuse( RageColor(1,1,1,0) );
|
OFF_COMMAND( m_sprAnswerBox );
|
||||||
|
OFF_COMMAND( m_textAnswer );
|
||||||
m_textAnswer.SetEffectNone();
|
OFF_COMMAND( m_sprCursor );
|
||||||
|
|
||||||
m_textAnswer.BeginTweening( 0.2f );
|
|
||||||
m_textAnswer.SetDiffuse( RageColor(1,1,1,0) );
|
|
||||||
|
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
|
|
||||||
@@ -261,7 +383,7 @@ void ScreenTextEntry::MenuStart( PlayerNumber pn )
|
|||||||
void ScreenTextEntry::MenuBack( PlayerNumber pn )
|
void ScreenTextEntry::MenuBack( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_bCancelled = true;
|
m_bCancelled = true;
|
||||||
MenuStart(pn);
|
End();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,11 +9,35 @@
|
|||||||
#include "Quad.h"
|
#include "Quad.h"
|
||||||
#include "RandomSample.h"
|
#include "RandomSample.h"
|
||||||
#include "BGAnimation.h"
|
#include "BGAnimation.h"
|
||||||
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
|
enum KeyboardRow
|
||||||
|
{
|
||||||
|
KEYBOARD_ROW_1,
|
||||||
|
KEYBOARD_ROW_2,
|
||||||
|
KEYBOARD_ROW_3,
|
||||||
|
KEYBOARD_ROW_4,
|
||||||
|
KEYBOARD_ROW_SPECIAL,
|
||||||
|
NUM_KEYBOARD_ROWS
|
||||||
|
};
|
||||||
|
#define FOREACH_KeyboardRow( i ) FOREACH_ENUM( KeyboardRow, NUM_KEYBOARD_ROWS, i )
|
||||||
|
enum KeyboardRowSpecialKey
|
||||||
|
{
|
||||||
|
CAPS, SPACEBAR, BACKSPACE, DONE
|
||||||
|
};
|
||||||
|
enum KeyboardCase
|
||||||
|
{
|
||||||
|
LOWERCASE,
|
||||||
|
UPPERCASE,
|
||||||
|
NUM_KEYBOARD_CASES
|
||||||
|
};
|
||||||
|
#define FOREACH_KeyboardCase( i ) FOREACH_ENUM( KeyboardCase, NUM_KEYBOARD_CASES, i )
|
||||||
|
|
||||||
class ScreenTextEntry : public Screen
|
class ScreenTextEntry : public Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenTextEntry( CString sName, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL, bool bPassword = false );
|
ScreenTextEntry( CString sName, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL, bool bPassword = false );
|
||||||
|
~ScreenTextEntry();
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
@@ -25,27 +49,47 @@ public:
|
|||||||
static bool s_bCancelledLast;
|
static bool s_bCancelledLast;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void MenuLeft( PlayerNumber pn );
|
void MoveX( int iDir );
|
||||||
virtual void MenuRight( PlayerNumber pn );
|
void MoveY( int iDir );
|
||||||
|
|
||||||
|
void End();
|
||||||
|
|
||||||
|
virtual void MenuLeft( PlayerNumber pn ) { MoveX(-1); }
|
||||||
|
virtual void MenuRight( PlayerNumber pn ) { MoveX(+1); }
|
||||||
|
virtual void MenuUp( PlayerNumber pn ) { MoveY(-1); }
|
||||||
|
virtual void MenuDown( PlayerNumber pn ) { MoveY(+1); }
|
||||||
virtual void MenuStart( PlayerNumber pn );
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
virtual void MenuBack( PlayerNumber pn );
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
|
|
||||||
void UpdateText();
|
void UpdateKeyboardText();
|
||||||
|
void UpdateAnswerText();
|
||||||
|
|
||||||
CString m_sQuestion;
|
CString m_sQuestion;
|
||||||
bool m_bPassword;
|
bool m_bPassword;
|
||||||
BGAnimation m_Background;
|
AutoActor m_Background;
|
||||||
BitmapText m_textQuestion;
|
BitmapText m_textQuestion;
|
||||||
Quad m_rectAnswerBox;
|
AutoActor m_sprAnswerBox;
|
||||||
wstring m_sAnswer;
|
wstring m_sAnswer;
|
||||||
BitmapText m_textAnswer;
|
BitmapText m_textAnswer;
|
||||||
void(*m_pOnOK)( CString sAnswer );
|
void(*m_pOnOK)( CString sAnswer );
|
||||||
void(*m_pOnCancel)();
|
void(*m_pOnCancel)();
|
||||||
bool m_bCancelled;
|
bool m_bCancelled;
|
||||||
|
|
||||||
|
AutoActor m_sprCursor;
|
||||||
|
|
||||||
|
int m_iFocusX;
|
||||||
|
KeyboardRow m_iFocusY;
|
||||||
|
|
||||||
|
void PositionCursor();
|
||||||
|
|
||||||
|
vector<CString> m_Keys[NUM_KEYBOARD_CASES][NUM_KEYBOARD_ROWS];
|
||||||
|
vector<BitmapText*> m_textKeyboardChars[NUM_KEYBOARD_ROWS];
|
||||||
|
|
||||||
Transition m_In;
|
Transition m_In;
|
||||||
Transition m_Out;
|
Transition m_Out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3178,14 +3178,6 @@ SOURCE=.\UnlockManager.cpp
|
|||||||
|
|
||||||
SOURCE=.\UnlockManager.h
|
SOURCE=.\UnlockManager.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\VirtualKeyboard.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\VirtualKeyboard.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Crypto"
|
# Begin Group "Crypto"
|
||||||
|
|
||||||
|
|||||||
@@ -2544,12 +2544,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="UnlockManager.h">
|
RelativePath="UnlockManager.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\VirtualKeyboard.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\VirtualKeyboard.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="ezsockets.cpp">
|
RelativePath="ezsockets.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -1,232 +0,0 @@
|
|||||||
/*
|
|
||||||
* Commands are mapped as follows:
|
|
||||||
* left - delete
|
|
||||||
* right - move cursor right (with space as default character)
|
|
||||||
* up/down - change right most character to next/previous character
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "global.h"
|
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
|
|
||||||
VirtualKeyboard VIRTUALKB;
|
|
||||||
|
|
||||||
VirtualKeyboard::VirtualKeyboard()
|
|
||||||
{
|
|
||||||
currentMode = VKMODE_PROFILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
VirtualKeyboard::~VirtualKeyboard()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void VirtualKeyboard::Reset( VirtualKeyboardMode mode )
|
|
||||||
{
|
|
||||||
currentMode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t VirtualKeyboard::Translate( const DeviceInput& DeviceI, const MenuInput &MenuI, const wstring &cur_string, bool *nextChar )
|
|
||||||
{
|
|
||||||
*nextChar = false;
|
|
||||||
MenuButton button = MenuI.button;
|
|
||||||
|
|
||||||
switch( button )
|
|
||||||
{
|
|
||||||
case MENU_BUTTON_LEFT: return KEY_BACK;
|
|
||||||
case MENU_BUTTON_START: return KEY_ENTER;
|
|
||||||
case MENU_BUTTON_BACK: return KEY_ESC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(button == MENU_BUTTON_RIGHT)
|
|
||||||
{
|
|
||||||
*nextChar = true;
|
|
||||||
switch( currentMode )
|
|
||||||
{
|
|
||||||
case VKMODE_PROFILE: return ' ';
|
|
||||||
case VKMODE_IP: return '0';
|
|
||||||
default: FAIL_M( ssprintf("%i", currentMode) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(button == MENU_BUTTON_UP)
|
|
||||||
{
|
|
||||||
if(cur_string.empty())
|
|
||||||
{
|
|
||||||
*nextChar = true;
|
|
||||||
return 'a';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wchar_t c = cur_string[cur_string.size() - 1];
|
|
||||||
|
|
||||||
if(c == ' ')
|
|
||||||
c = 'a';
|
|
||||||
else if(c == 'z')
|
|
||||||
c = 'A';
|
|
||||||
else if(c == 'Z')
|
|
||||||
c = '0';
|
|
||||||
else if(c == '9' && currentMode != VKMODE_IP)
|
|
||||||
c = '!';
|
|
||||||
else if(c == '9' && currentMode == VKMODE_IP)
|
|
||||||
c = '.';
|
|
||||||
else if(c == '.' && currentMode == VKMODE_IP)
|
|
||||||
c = '0';
|
|
||||||
else if(c == '/')
|
|
||||||
c = ':';
|
|
||||||
else if(c == '@')
|
|
||||||
c = '[';
|
|
||||||
else if(c == '`')
|
|
||||||
c = '{';
|
|
||||||
else if(c == '~')
|
|
||||||
c = ' ';
|
|
||||||
else
|
|
||||||
c++;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(button == MENU_BUTTON_DOWN)
|
|
||||||
{
|
|
||||||
if(cur_string.empty())
|
|
||||||
{
|
|
||||||
*nextChar = true;
|
|
||||||
return 'z';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wchar_t c = cur_string[cur_string.size() - 1];
|
|
||||||
|
|
||||||
if(c == ' ')
|
|
||||||
c = '~';
|
|
||||||
else if(c == 'a')
|
|
||||||
c = ' ';
|
|
||||||
else if(c == 'A')
|
|
||||||
c = 'z';
|
|
||||||
else if(c == '0' && currentMode != VKMODE_IP)
|
|
||||||
c = 'Z';
|
|
||||||
else if(c == '0' && currentMode == VKMODE_IP)
|
|
||||||
c = '.';
|
|
||||||
else if(c == '.' && currentMode == VKMODE_IP)
|
|
||||||
c = '9';
|
|
||||||
else if(c == '!')
|
|
||||||
c = '9';
|
|
||||||
else if(c == ':')
|
|
||||||
c = '/';
|
|
||||||
else if(c == '[')
|
|
||||||
c = '@';
|
|
||||||
else if(c == '{')
|
|
||||||
c = '`';
|
|
||||||
else
|
|
||||||
c--;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// platform specific handlers here
|
|
||||||
#if defined(XBOX)
|
|
||||||
int dButton = DeviceI.button;
|
|
||||||
|
|
||||||
if(dButton == JOY_1) // A
|
|
||||||
{
|
|
||||||
// make a space or .
|
|
||||||
|
|
||||||
switch( currentMode )
|
|
||||||
{
|
|
||||||
case VKMODE_PROFILE:
|
|
||||||
{
|
|
||||||
if(cur_string.empty())
|
|
||||||
*nextChar = true;
|
|
||||||
|
|
||||||
return ' ';
|
|
||||||
}
|
|
||||||
case VKMODE_IP:
|
|
||||||
{
|
|
||||||
if(!cur_string.empty())
|
|
||||||
return '.';
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(dButton == JOY_4) // Y
|
|
||||||
{
|
|
||||||
// switch to next character type
|
|
||||||
if(cur_string.empty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int c = cur_string[cur_string.size() - 1];
|
|
||||||
|
|
||||||
if(c >= 'a' && c <= 'z')
|
|
||||||
{
|
|
||||||
c = toupper(c);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
else if(c >= 'A' && c <= 'Z')
|
|
||||||
{
|
|
||||||
return '0';
|
|
||||||
}
|
|
||||||
else if(c >= '0' && c <= '9' && currentMode != VKMODE_IP)
|
|
||||||
{
|
|
||||||
return '!';
|
|
||||||
}
|
|
||||||
else if((c >= '!' && c <= '/') || (c >= ':' && c <= '@') ||
|
|
||||||
(c >= '[' && c <= '`') || (c >= '{' || c <= '~'))
|
|
||||||
{
|
|
||||||
return 'a';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(button == JOY_2) // B
|
|
||||||
{
|
|
||||||
// switch to previous character type
|
|
||||||
if(cur_string.empty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int c = cur_string[cur_string.size() - 1];
|
|
||||||
|
|
||||||
if(c >= 'a' && c <= 'z')
|
|
||||||
{
|
|
||||||
return '!';
|
|
||||||
}
|
|
||||||
else if(c >= 'A' && c <= 'Z')
|
|
||||||
{
|
|
||||||
return 'a';
|
|
||||||
}
|
|
||||||
else if(c >= '0' && c <= '9' && currentMode != VKMODE_IP)
|
|
||||||
{
|
|
||||||
return 'A';
|
|
||||||
}
|
|
||||||
else if((c >= '!' && c <= '/') || (c >= ':' && c <= '@') ||
|
|
||||||
(c >= '[' && c <= '`') || (c >= '{' || c <= '~'))
|
|
||||||
{
|
|
||||||
return '0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) 2004 Ryan Dortmans
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
||||||
* whom the Software is furnished to do so, provided that the above
|
|
||||||
* copyright notice(s) and this permission notice appear in all copies of
|
|
||||||
* the Software and that both the above copyright notice(s) and this
|
|
||||||
* permission notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
||||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
||||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
||||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
||||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/* VirtualKeyboard - Allows a user to enter text without a keyboard. */
|
|
||||||
|
|
||||||
#ifndef VIRTUAL_KEYBOARD_H
|
|
||||||
#define VIRTUAL_KEYBOARD_H
|
|
||||||
|
|
||||||
#include "RageInputDevice.h"
|
|
||||||
#include "MenuInput.h"
|
|
||||||
|
|
||||||
enum VirtualKeyboardMode { VKMODE_PROFILE, VKMODE_IP };
|
|
||||||
|
|
||||||
class VirtualKeyboard
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VirtualKeyboard();
|
|
||||||
~VirtualKeyboard();
|
|
||||||
|
|
||||||
void Reset( VirtualKeyboardMode mode );
|
|
||||||
wchar_t Translate( const DeviceInput& DeviceI, const MenuInput &MenuI, const wstring &cur_string, bool *nextChar );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
VirtualKeyboardMode currentMode;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern VirtualKeyboard VIRTUALKB;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) 2004 Ryan Dortmans
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
||||||
* whom the Software is furnished to do so, provided that the above
|
|
||||||
* copyright notice(s) and this permission notice appear in all copies of
|
|
||||||
* the Software and that both the above copyright notice(s) and this
|
|
||||||
* permission notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
||||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
||||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
||||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
||||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user