Advertisement
SteelGolem

keeping a keyboard double buffer in SDL

Jan 18th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. // start of Update ()
  2.         keyboard = SDL_GetKeyboardState (&numKeys);
  3.         if (numKeys > lastNumKeys)
  4.         {
  5.             if (lastKeyboard) free ((void *) lastKeyboard);
  6.             lastKeyboard = (Uint8 *) malloc (numKeys * sizeof (Uint8));
  7.         }
  8.  
  9. // end of Update ()
  10.         memcpy ((void *) lastKeyboard, (void *) keyboard, numKeys * sizeof (Uint8));
  11.         lastNumKeys = numKeys;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement