Translate non-keyboard input to keyboard input
This commit is contained in:
@@ -324,6 +324,8 @@ void PrefsManager::Init()
|
|||||||
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
||||||
m_iProductID = 1;
|
m_iProductID = 1;
|
||||||
|
|
||||||
|
m_bEnableVirtualKeyboard = true;
|
||||||
|
|
||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
m_bEnableVirtualMemory = true;
|
m_bEnableVirtualMemory = true;
|
||||||
m_iPageFileSize = 384;
|
m_iPageFileSize = 384;
|
||||||
@@ -589,6 +591,8 @@ void PrefsManager::ReadPrefsFromFile( CString sIni )
|
|||||||
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 );
|
||||||
@@ -850,6 +854,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() 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,6 +278,9 @@ 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;
|
||||||
|
|||||||
@@ -11,10 +11,7 @@
|
|||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "NetworkSyncServer.h"
|
#include "NetworkSyncServer.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualKeyboard.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PO_CONNECTION,
|
PO_CONNECTION,
|
||||||
@@ -117,11 +114,7 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
case PO_CONNECTION:
|
case PO_CONNECTION:
|
||||||
if ( !NSMAN->useSMserver )
|
if ( !NSMAN->useSMserver )
|
||||||
{
|
{
|
||||||
|
VIRTUALKB.Reset(VKMODE_IP);
|
||||||
#if defined(XBOX)
|
|
||||||
XBOX_VKB.Reset(VKMODE_IP);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SCREENMAN->TextEntry( SM_DoneConnecting, "Enter a Network Address\n127.0.0.1 to connect to yourself", PREFSMAN->m_sLastServer );
|
SCREENMAN->TextEntry( SM_DoneConnecting, "Enter a Network Address\n127.0.0.1 to connect to yourself", PREFSMAN->m_sLastServer );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -136,10 +129,7 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
case NO_START_SERVER:
|
case NO_START_SERVER:
|
||||||
if (!NSMAN->isLanServer)
|
if (!NSMAN->isLanServer)
|
||||||
{
|
{
|
||||||
#if defined(XBOX)
|
VIRTUALKB.Reset(VKMODE_PROFILE);
|
||||||
XBOX_VKB.Reset(VKMODE_PROFILE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SCREENMAN->TextEntry( SM_ServerNameEnter, "Enter a server name...", "", NULL );
|
SCREENMAN->TextEntry( SM_ServerNameEnter, "Enter a server name...", "", NULL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -11,12 +11,9 @@
|
|||||||
#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>
|
||||||
|
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualKeyboard.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EXISTINGBG_WIDTH THEME->GetMetricF(m_sName,"PackagesBGWidth")
|
#define EXISTINGBG_WIDTH THEME->GetMetricF(m_sName,"PackagesBGWidth")
|
||||||
#define WEBBG_WIDTH THEME->GetMetricF(m_sName,"WebBGWidth")
|
#define WEBBG_WIDTH THEME->GetMetricF(m_sName,"WebBGWidth")
|
||||||
#define NUM_PACKAGES_SHOW THEME->GetMetricI(m_sName,"NumPackagesShow")
|
#define NUM_PACKAGES_SHOW THEME->GetMetricI(m_sName,"NumPackagesShow")
|
||||||
@@ -162,9 +159,7 @@ void ScreenPackages::MenuStart( PlayerNumber pn )
|
|||||||
{
|
{
|
||||||
if ( m_iLinksPos == 0 )
|
if ( m_iLinksPos == 0 )
|
||||||
{
|
{
|
||||||
#if defined(XBOX)
|
VIRTUALKB.Reset(VKMODE_PROFILE); // allow all characters
|
||||||
XBOX_VKB.Reset(VKMODE_PROFILE); // allow all characters
|
|
||||||
#endif
|
|
||||||
SCREENMAN->TextEntry( SM_BackFromURL, "Enter URL:", "http://" );
|
SCREENMAN->TextEntry( SM_BackFromURL, "Enter URL:", "http://" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualKeyboard.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -179,9 +176,7 @@ void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
{
|
{
|
||||||
case PO_CREATE_NEW:
|
case PO_CREATE_NEW:
|
||||||
|
|
||||||
#if defined(XBOX)
|
VIRTUALKB.Reset(VKMODE_PROFILE); // set the xbox virtual keyboard to profile mode
|
||||||
XBOX_VKB.Reset(VKMODE_PROFILE); // set the xbox virtual keyboard to profile mode
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "FontCharAliases.h"
|
#include "FontCharAliases.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualKeyboard.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define QUESTION_X (SCREEN_CENTER_X)
|
#define QUESTION_X (SCREEN_CENTER_X)
|
||||||
#define QUESTION_Y (SCREEN_CENTER_Y - 60)
|
#define QUESTION_Y (SCREEN_CENTER_Y - 60)
|
||||||
@@ -100,27 +97,29 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
|
|
||||||
int button = DeviceI.button;
|
int button = DeviceI.button;
|
||||||
|
|
||||||
#if defined(XBOX)
|
if(PREFSMAN->m_bEnableVirtualKeyboard)
|
||||||
bool nextChar = false;
|
|
||||||
|
|
||||||
int toAdd = XBOX_VKB.Translate(button, m_sAnswer, &nextChar);
|
|
||||||
|
|
||||||
if( toAdd != 0 && toAdd != KEY_BACK && toAdd != KEY_ESC && toAdd != KEY_ENTER )
|
|
||||||
{
|
{
|
||||||
if(!nextChar)
|
bool nextChar = false;
|
||||||
|
|
||||||
|
int toAdd = VIRTUALKB.Translate(DeviceI, MenuI, m_sAnswer, &nextChar);
|
||||||
|
|
||||||
|
if( toAdd != 0 && toAdd != KEY_BACK && toAdd != KEY_ESC && toAdd != KEY_ENTER )
|
||||||
{
|
{
|
||||||
if(!m_sAnswer.empty())
|
if(!nextChar)
|
||||||
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
{
|
||||||
|
if(!m_sAnswer.empty())
|
||||||
|
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sAnswer += toAdd;
|
||||||
|
|
||||||
|
UpdateText();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sAnswer += toAdd;
|
button = toAdd;
|
||||||
|
|
||||||
UpdateText();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button = toAdd;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch( button )
|
switch( button )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2411,6 +2411,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="UnlockSystem.h">
|
RelativePath="UnlockSystem.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Crypto"
|
Name="Crypto"
|
||||||
|
|||||||
@@ -3098,6 +3098,14 @@ SOURCE=.\UnlockSystem.cpp
|
|||||||
|
|
||||||
SOURCE=.\UnlockSystem.h
|
SOURCE=.\UnlockSystem.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"
|
||||||
|
|
||||||
|
|||||||
@@ -2409,6 +2409,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ezsockets.h">
|
RelativePath="ezsockets.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Crypto"
|
Name="Crypto"
|
||||||
|
|||||||
@@ -513,10 +513,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
RelativePath="ScreenNetEvaluation.h">
|
RelativePath="ScreenNetEvaluation.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetSelectMusic.cpp">
|
RelativePath="ScreenNetRoom.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetSelectMusic.h">
|
RelativePath="ScreenNetRoom.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetSelectBase.cpp">
|
RelativePath="ScreenNetSelectBase.cpp">
|
||||||
@@ -525,10 +525,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
RelativePath="ScreenNetSelectBase.h">
|
RelativePath="ScreenNetSelectBase.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetRoom.cpp">
|
RelativePath="ScreenNetSelectMusic.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetRoom.h">
|
RelativePath="ScreenNetSelectMusic.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetworkOptions.cpp">
|
RelativePath="ScreenNetworkOptions.cpp">
|
||||||
@@ -674,6 +674,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ScreenStyleSplash.h">
|
RelativePath="ScreenStyleSplash.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ScreenSystemLayer.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ScreenSystemLayer.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenTest.cpp">
|
RelativePath="ScreenTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -1339,12 +1345,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
<File
|
<File
|
||||||
RelativePath="archutils\Xbox\GraphicsWindow.h">
|
RelativePath="archutils\Xbox\GraphicsWindow.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\archutils\Xbox\VirtualKeyboard.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\archutils\Xbox\VirtualKeyboard.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\archutils\Xbox\VirtualMemory.cpp">
|
RelativePath=".\archutils\Xbox\VirtualMemory.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -2416,6 +2416,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
<File
|
<File
|
||||||
RelativePath="UnlockSystem.h">
|
RelativePath="UnlockSystem.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VirtualKeyboard.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Crypto"
|
Name="Crypto"
|
||||||
|
|||||||
@@ -0,0 +1,219 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
|
|
||||||
|
VirtualKeyboard VIRTUALKB;
|
||||||
|
|
||||||
|
VirtualKeyboard::VirtualKeyboard()
|
||||||
|
{
|
||||||
|
currentMode = VKMODE_PROFILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtualKeyboard::~VirtualKeyboard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard::Reset(VirtualKeyboardMode mode)
|
||||||
|
{
|
||||||
|
currentMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VirtualKeyboard::Translate(const DeviceInput& DeviceI, const MenuInput &MenuI, const wstring &cur_string, bool *nextChar)
|
||||||
|
{
|
||||||
|
*nextChar = false;
|
||||||
|
MenuButton button = MenuI.button;
|
||||||
|
|
||||||
|
if(button == MENU_BUTTON_LEFT)
|
||||||
|
return KEY_BACK;
|
||||||
|
else if(button == MENU_BUTTON_RIGHT)
|
||||||
|
{
|
||||||
|
*nextChar = true;
|
||||||
|
if(currentMode == VKMODE_PROFILE)
|
||||||
|
return ' ';
|
||||||
|
else
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
else if(button == MENU_BUTTON_UP)
|
||||||
|
{
|
||||||
|
if(cur_string.empty())
|
||||||
|
{
|
||||||
|
*nextChar = true;
|
||||||
|
return 'a';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int 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
|
||||||
|
{
|
||||||
|
int 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 if(button == MENU_BUTTON_START)
|
||||||
|
return KEY_ENTER;
|
||||||
|
else if(button == MENU_BUTTON_BACK)
|
||||||
|
return KEY_ESC;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// platform specific handlers here
|
||||||
|
#if defined(XBOX)
|
||||||
|
int dButton = DeviceI.button;
|
||||||
|
|
||||||
|
if(dButton == JOY_1) // A
|
||||||
|
{
|
||||||
|
// make a space or .
|
||||||
|
|
||||||
|
if(currentMode != VKMODE_IP)
|
||||||
|
{
|
||||||
|
if(cur_string.empty())
|
||||||
|
*nextChar = true;
|
||||||
|
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
else if(currentMode == 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.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* Allows a user to input profile names or IP addresses without using a keyboard.
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(VIRTUAL_KEYBOARD_H)
|
||||||
|
#define VIRTUAL_KEYBOARD_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RageInputDevice.h"
|
||||||
|
#include "MenuInput.h"
|
||||||
|
|
||||||
|
enum VirtualKeyboardMode { VKMODE_PROFILE, VKMODE_IP };
|
||||||
|
|
||||||
|
class VirtualKeyboard
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VirtualKeyboard();
|
||||||
|
~VirtualKeyboard();
|
||||||
|
|
||||||
|
void Reset(VirtualKeyboardMode mode);
|
||||||
|
int 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