sdl@lists.libsdl.org
[Top] [All Lists]

Re: [SDL] My thoughts on keyboard input in SDL 1.3

Subject: Re: [SDL] My thoughts on keyboard input in SDL 1.3
From: Bob Pendleton
Date: Fri, 25 Jan 2008 14:04:46 -0600
On Fri, 2008-01-25 at 20:32 +0100, Christian Walther wrote:
> Bob Pendleton wrote:
> > Tools, not rules. You can't force people to do things the way you think
> > they should be done.
> 
> It's not my intention to force anything. I just want to make it *easy* 
> to do things right, because otherwise I fear it's not going to be done. 
> Of course, if it turns out that my idea of what's "right" is not 
> universally accepted (and I'm grateful if that is pointed out to me), 
> then there's nothing I can do but shut up, I guess... :)

Well, in this case I was wrong because I did not look at how this was
implemented in SDL 1.2. I still don't like it, but being compatible is
better for the end users.

> 
> > It is better to give someone a tool that lets
> > them do what they want rather than to force them to work around what you
> > think it should be.
> 
> Certainly. Personally, I'm happy as long as it's *possible* to do things 
> right. In this particular case that means, given a layout key code, 
> present it to the user in a way that uniquely identifies the key to him. 
> That means, being able to distinguish between keyboard and keypad keys 
> that type the same character. And I see no other way for this than the 
> magic bit we're trying to get rid of...

I now see how you got to the magic keypad bit. But, I don't think it is
the correct solution because, as I understand it, 

SDL_GetLayoutKey(SDLK_1) == code point for 1

and

SDL_GetLayoutKey(SDLK_KP_1) == code point for 1 | magic key pad bit.

But, there is no good way for a developer to test for 1 | magic key pad
bit. There is no enumeration of these values and it forces the
programmer to create them and know what they are. Adding that bit means
that SDL_GetLayoutKey really returns 3 different types of value, SDLK_*,
Unicode code points, and something that is not a code point nor an
SDLK_*.

        Bob Pendleton



> 
>   -Christian
> 
> _______________________________________________
> SDL mailing list
> SDL@xxxxxxxxxxxxxxxx
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> 
-- 
+--------------------------------------+
+ Bob Pendleton: writer and programmer +
+ email: Bob@xxxxxxxxxxxxx             +
+ web: www.GameProgrammer.com          +
+ www.Wise2Food.com                    +
+ nutrient info on 7,000+ common foods +
+--------------------------------------+


_______________________________________________
SDL mailing list
SDL@xxxxxxxxxxxxxxxx
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

<Prev in Thread] Current Thread [Next in Thread>