mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
- Added a default keyboard layout for launching the game. It's fixed crash when a game running with the extend unicode keyboard (cyrillic, for example).
This commit is contained in:
parent
65099897f4
commit
e18fbcfb89
5 changed files with 41 additions and 2 deletions
|
|
@ -118,6 +118,9 @@ public:
|
||||||
|
|
||||||
static U8 getModifierKeys() {return smModifierKeys;}
|
static U8 getModifierKeys() {return smModifierKeys;}
|
||||||
static void setModifierKeys(U8 mod) {smModifierKeys = mod;}
|
static void setModifierKeys(U8 mod) {smModifierKeys = mod;}
|
||||||
|
|
||||||
|
static void attemptSwitchToKeyboardLayout( U32 layout );
|
||||||
|
|
||||||
#ifdef LOG_INPUT
|
#ifdef LOG_INPUT
|
||||||
static void log( const char* format, ... );
|
static void log( const char* format, ... );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
// Static class variables:
|
// Static class variables:
|
||||||
InputManager* Input::smManager;
|
InputManager* Input::smManager;
|
||||||
bool Input::smActive;
|
bool Input::smActive;
|
||||||
|
|
@ -79,6 +81,10 @@ void Input::init()
|
||||||
|
|
||||||
destroy();
|
destroy();
|
||||||
|
|
||||||
|
#ifdef TORQUE_DEFAULT_KEYBOARD_LAYOUT
|
||||||
|
attemptSwitchToKeyboardLayout( TORQUE_DEFAULT_KEYBOARD_LAYOUT );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LOG_INPUT
|
#ifdef LOG_INPUT
|
||||||
struct tm* newTime;
|
struct tm* newTime;
|
||||||
time_t aclock;
|
time_t aclock;
|
||||||
|
|
@ -487,6 +493,18 @@ InputManager* Input::getManager()
|
||||||
return( smManager );
|
return( smManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void Input::attemptSwitchToKeyboardLayout( U32 layout )
|
||||||
|
{
|
||||||
|
const auto lang = MAKELANGID( layout, SUBLANG_DEFAULT );
|
||||||
|
std::wstringstream ss;
|
||||||
|
ss << std::hex << lang;
|
||||||
|
const auto hexLang = ss.str().c_str();
|
||||||
|
ActivateKeyboardLayout( LoadKeyboardLayout(
|
||||||
|
hexLang, KLF_ACTIVATE | KLF_REPLACELANG
|
||||||
|
), KLF_REORDER );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LOG_INPUT
|
#ifdef LOG_INPUT
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void Input::log( const char* format, ... )
|
void Input::log( const char* format, ... )
|
||||||
|
|
|
||||||
|
|
@ -458,8 +458,12 @@ bool ActionMap::createEventDescriptor(const char* pEventString, EventDescriptor*
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we need to map the key string to the proper KEY code from event.h
|
// Now we need to map the key string to the proper KEY code from event.h
|
||||||
//
|
AssertFatal(
|
||||||
AssertFatal(dStrlen(pObjectString) != 0, "Error, no key was specified!");
|
dStrlen( pObjectString ) > 0,
|
||||||
|
"Error, no key was specified!\n"
|
||||||
|
"Review file 'scripts/client/config.cs' and remove symbols"
|
||||||
|
" which is not latin. Or delete this file."
|
||||||
|
);
|
||||||
|
|
||||||
if (dStrlen(pObjectString) == 1)
|
if (dStrlen(pObjectString) == 1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,13 @@
|
||||||
/// texture manager.
|
/// texture manager.
|
||||||
#define TORQUE_FRAME_SIZE 16 << 20
|
#define TORQUE_FRAME_SIZE 16 << 20
|
||||||
|
|
||||||
|
// Default keyboard layout for launching the game. It's fixed crash when a
|
||||||
|
// game running with the extend unicode keyboard (cyrillic, for example).
|
||||||
|
// Windows only.
|
||||||
|
// @see For choice language >
|
||||||
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx
|
||||||
|
#define TORQUE_DEFAULT_KEYBOARD_LAYOUT LANG_ENGLISH
|
||||||
|
|
||||||
// Finally, we define some dependent #defines. This enables some subsidiary
|
// Finally, we define some dependent #defines. This enables some subsidiary
|
||||||
// functionality to get automatically turned on in certain configurations.
|
// functionality to get automatically turned on in certain configurations.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,13 @@
|
||||||
/// texture manager.
|
/// texture manager.
|
||||||
#define TORQUE_FRAME_SIZE 16 << 20
|
#define TORQUE_FRAME_SIZE 16 << 20
|
||||||
|
|
||||||
|
// Default keyboard layout for launching the game. It's fixed crash when a
|
||||||
|
// game running with the extend unicode keyboard (cyrillic, for example).
|
||||||
|
// Windows only.
|
||||||
|
// @see For choice language >
|
||||||
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx
|
||||||
|
#define TORQUE_DEFAULT_KEYBOARD_LAYOUT LANG_ENGLISH
|
||||||
|
|
||||||
// Finally, we define some dependent #defines. This enables some subsidiary
|
// Finally, we define some dependent #defines. This enables some subsidiary
|
||||||
// functionality to get automatically turned on in certain configurations.
|
// functionality to get automatically turned on in certain configurations.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue