mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Character type fixes for building with clang-cl
This commit is contained in:
parent
01471c9ef3
commit
4386ababbe
2 changed files with 12 additions and 2 deletions
|
|
@ -54,7 +54,17 @@ struct EmptyType {}; ///< "Null" type used by templates
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
typedef char UTF8; ///< Compiler independent 8 bit Unicode encoded character
|
typedef char UTF8; ///< Compiler independent 8 bit Unicode encoded character
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(__clang__)
|
||||||
|
// Clang's MSVC compatibility mode doesn't currently support /Zc:wchar_t-,
|
||||||
|
// which we rely on to avoid type conversion errors when calling system
|
||||||
|
// APIs when wchar_t is defined as unsigned short. So, just define UTF16
|
||||||
|
// as wchar_t instead since it's always a 2 byte unsigned on windows anyway.
|
||||||
|
typedef wchar_t UTF16;
|
||||||
|
#else
|
||||||
typedef unsigned short UTF16; ///< Compiler independent 16 bit Unicode encoded character
|
typedef unsigned short UTF16; ///< Compiler independent 16 bit Unicode encoded character
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef unsigned int UTF32; ///< Compiler independent 32 bit Unicode encoded character
|
typedef unsigned int UTF32; ///< Compiler independent 32 bit Unicode encoded character
|
||||||
|
|
||||||
typedef const char* StringTableEntry;
|
typedef const char* StringTableEntry;
|
||||||
|
|
|
||||||
|
|
@ -137,14 +137,14 @@ static void _keyboardEvent(Win32Window* window,UINT message, WPARAM wParam, WPAR
|
||||||
&& window->getKeyboardTranslation()
|
&& window->getKeyboardTranslation()
|
||||||
&& !window->shouldNotTranslate( torqueMods, newVirtKey ) )
|
&& !window->shouldNotTranslate( torqueMods, newVirtKey ) )
|
||||||
{
|
{
|
||||||
U16 chars[ 64 ];
|
wchar_t chars[ 64 ];
|
||||||
dMemset( chars, 0, sizeof( chars ) );
|
dMemset( chars, 0, sizeof( chars ) );
|
||||||
|
|
||||||
S32 res = ToUnicode( keyCode, scanCode, keyboardState, chars, sizeof( chars ) / sizeof( chars[ 0 ] ), 0 );
|
S32 res = ToUnicode( keyCode, scanCode, keyboardState, chars, sizeof( chars ) / sizeof( chars[ 0 ] ), 0 );
|
||||||
|
|
||||||
// This should only happen on Window 9x/ME systems
|
// This should only happen on Window 9x/ME systems
|
||||||
if( res == 0 )
|
if( res == 0 )
|
||||||
res = ToAscii( keyCode, scanCode, keyboardState, chars, 0 );
|
res = ToAscii( keyCode, scanCode, keyboardState, (LPWORD)chars, 0 );
|
||||||
|
|
||||||
if( res >= 1 )
|
if( res >= 1 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue