[SDL] resource leak in WIN_FreeWMCursor
hj at imbens.nl
Wed Sep 25 07:16:00 PDT 2002
Hi! I'm writing a little tetris clone to teach myself SDL, and I've run
across an interesting problem: what's the best way to implement
You only need eight digital inputs to play Tetris (up, down, left,
right, spin-left, spin-right, start, and select) which I have in an
enum. My first attempt at keybinding was to have an array of keysyms
(int keysyms), but that meant scanning the array every time I got a
keypress, which meant repeated code in every key-related or
My next attempt was just for the joystick-button binding - I made an
array as big as the number of buttons on the first joystick, and put one
of the Tetris keycodes into the entry for each button that was bound.
That worked, made a lot of code shorter and easier to read, but there's
something like 350+ different keysyms that you can get events for, which
seems a little large just for keybinding.
Ideally, I'd like to use a hash of the event type and keysym or
button-number as an index into an array, but that seems a little complex.
How do you deal with keybinding in your SDL application?
More information about the SDL