code_glitch
29-08-2011, 01:38 PM
For the past few days, I've been working on an X11 layer to replace SDL in my future applications. All has been nice sailing up until now where I've arrived on stranger tides :D
Ok, jokes aside, I have this:
PMEvent.LastKeyDown := XKeySymToKeyCode(Display, XLookupKeySym(@event.xkey, 0));
and
PMEvent.LastKeyDown := Display, XLookupKeySym(@event.xkey, 0);
Now although both appear to work - they do not work the way they should. The first implementation results in the following behaviour:
q=24, w=25, e=26 and so on for each row of keys on the keyboard
The second implementation returns the 'correct' values and can be reliably fed from Ord() and into char() however pressing up, esc etc results in values over 65,000! :o
Has anyone come up with a solution to this - or at least can find a way of getting these to match the 'correct' sdl and readkey() keycodes?
Ok, jokes aside, I have this:
PMEvent.LastKeyDown := XKeySymToKeyCode(Display, XLookupKeySym(@event.xkey, 0));
and
PMEvent.LastKeyDown := Display, XLookupKeySym(@event.xkey, 0);
Now although both appear to work - they do not work the way they should. The first implementation results in the following behaviour:
q=24, w=25, e=26 and so on for each row of keys on the keyboard
The second implementation returns the 'correct' values and can be reliably fed from Ord() and into char() however pressing up, esc etc results in values over 65,000! :o
Has anyone come up with a solution to this - or at least can find a way of getting these to match the 'correct' sdl and readkey() keycodes?