Thread: key detection with SDL library

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    coder
    Join Date
    Feb 2008
    Posts
    127

    key detection with SDL library

    hello

    I am making a chat program which (obviously) needs to detect the ascii of the key pressed.

    Unfortunately I can get only the ascii of the "real" key pressed.
    I don't know how to explain that, so here's an example:

    when the user presses just <a>, SDL gives me the code 97 (which is the correct ascii code for "a")
    if the user presses <SHIFT + a>, SDL again gives me 303 (the R-SHIFT code used by SDL) and again 97.

    ok, I simply might recognize when the user presses shift, which is not a hard deal but...
    if I have to check for non-alphabetical keys?
    here is the complication, explained with a comparation:

    italian user presses <9> : ascii code is 57
    english user presses <9> : ascii code is 57

    italian user presses <SHIFT + 9> : character is ")", ascii code is 41
    english user presses <SHIFT + 9> : character is "(", ascii code is 40

    I've already tried to implement a function which detects the input, but there happen some conflicts with SDL.
    also my knowledge with low-level C coding is not good.

    Which way should I start from? thanks

    edit: I'd also be glad to make it portable

    edit solved: ok, nevermind, I've just found the perfect solution:
    http://listas.apesol.org/pipermail/s...ne/044058.html
    Last edited by carlorfeo; 02-07-2008 at 08:40 AM. Reason: solved

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. SDL multiple key presses...Help.
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2003, 11:52 AM
  4. key detection
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2001, 09:48 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM