[SDL] Displaying keys pushed on european keyboards?

Alex Barry alex.barry at gmail.com
Thu Jul 21 21:08:28 PDT 2011


char* can still hold unicode characters, since it is just a pointer to
8 byte chunks.  UTF-8 characters could be held in 1 char each,
meanwhile UTF-16 in 2 chars each, etc.

On Thu, Jul 21, 2011 at 10:09 PM, Forest Hale <havoc at ghdigital.com> wrote:
> SDL_TextInputEvent provides a UTF-8 sequence of text that was typed by the
> user, which as I understand it may consist of multiple characters (and
> multiple bytes per character), including accent characters that modify the
> previous character.
>
> This is sometimes called MultiByte text, each character may consist of 1-5
> bytes of data, see the wikipedia page for an explanation:
> http://en.wikipedia.org/wiki/UTF-8
>
> When someone speaks of Unicode they are often referring to UTF-16, where
> each character may consist of 1 or 2 unsigned shorts (wchar_t):
> http://en.wikipedia.org/wiki/UTF-16
>
> The more or less canonical version of the Unicode system (where anything is
> a single unsigned int) is:
> http://en.wikipedia.org/wiki/UTF-32
>
> It is important to remember that text rendering can be rather ambiguous even
> in UTF-32 because of accent modifier sequences on a previous character.
>
> I don't know a lot about the details of Unicode text rendering, so I'm not
> much help beyond this basic information, my personal preference when
> programming is to use UTF-8, chiefly because it is compatible with regular
> asprintf and friends (in the sense that high characters will pass through
> "safely", one still must be careful with lengths).
>
> On 07/21/2011 06:33 PM, Patrick Baggett wrote:
>>
>> Unless it is UTF-8 encoded. What is being pointed to by it?
>>
>> On Thu, Jul 21, 2011 at 6:56 PM, VernJensen <vern at actionsoft.com
>> <mailto:vern at actionsoft.com>> wrote:
>>
>>    __
>>    **UPDATE**
>>
>>    So I wrote code to use the unicode value of the structure, and it turns
>> out it's always 0.
>>
>>    The SDL 1.3 code marks for this field in the headers (SDL_Keyboard.h):
>>
>>    /**< \deprecated use SDL_TextInputEvent instead */
>>
>>    However, SDL_TextInputEvent uses a char * for the input string, which
>> would *not* be unicode either.
>>
>>    So I'm guessing there is no way to do this in SDL 1.3?
>>
>>    _______________________________________________
>>    SDL mailing list
>>    SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
>>    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>
>>
>>
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
> --
> LordHavoc
> Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
> Co-designer of Nexuiz - http://alientrap.org/nexuiz
> "War does not prove who is right, it proves who is left." - Unknown
> "Any sufficiently advanced technology is indistinguishable from a rigged
> demo." - James Klass
> "A game is a series of interesting choices." - Sid Meier
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>



More information about the SDL mailing list