That takes a second to figure out and allocates.
Its not that important since SDL is a development driver the switch
is pretty clear IMHO.
On 1/6/06, Tom Bridgwater <[EMAIL PROTECTED]> wrote:
>
>
> On Jan 6, 2006, at 7:26 AM, Denis Oliver Kropp wrote:
> if (id >= DIKI_0 && id <= DIKI_9) {
> if (shift) {
> switch(id) {
> case DIKI_1: return DIKS_EXCLAMATION_MARK;
> case DIKI_2: return DIKS_AT;
> case DIKI_3: return DIKS_NUMBER_SIGN;
> case DIKI_4: return DIKS_DOLLAR_SIGN;
> case DIKI_5: return DIKS_PERCENT_SIGN;
> case DIKI_6: return DIKS_CIRCUMFLEX_ACCENT;
> case DIKI_7: return DIKS_AMPERSAND;
> case DIKI_8: return DIKS_ASTERISK;
> case DIKI_9: return DIKS_PARENTHESIS_LEFT;
> case DIKI_0: return DIKS_PARENTHESIS_RIGHT;
> default:;
> }
> }
> else
> return DIKS_0 + id - DIKI_0;
> }
>
> If you really care about saving logic, maybe try:
>
> if (id >= DIKI_0 && id <= DIKI_9) {
> static const DFBInputDeviceKeySymbol shift_number_symbols[10] = {
> DIKS_PARENTHESIS_RIGHT,
> DIKS_EXCLAMATION_MARK,
> DIKS_AT,
> DIKS_NUMBER_SIGN,
> DIKS_DOLLAR_SIGN,
> DIKS_PERCENT_SIGN,
> DIKS_CIRCUMFLEX_ACCENT,
> DIKS_AMPERSAND,
> DIKS_ASTERISK,
> DIKS_PARENTHESIS_LEFT
> };
> if (shift)
> return shift_number_symbols[id - DIKI_0];
> else
> return DIKS_0 + id - DIKI_0;
> }
>
>
>
> /TomB
> _______________________________________________
> directfb-dev mailing list
> [email protected]
> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
>
>
>
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev