void game_keypress(game_t g, int key, int down, const SDL_KeyboardEvent event) { /* let the console have first dibs - we might be typing into it or hitting the key to show it. */ if (con_keypress(key, down, event)) return; if ( NULL == g->g_ops || NULL == g->g_ops->keypress ) return; (*g->g_ops->keypress)(g->g_priv, key, down); }
void game_keypress(game_t g, int key, int down, const SDL_KeyboardEvent event) { /* let the console have first dibs - we might be typing into it or hitting the key to show it. */ if (con_keypress(key, down, event)) { /* notify other listeners that console has keyboard focus */ if ( g->g_ops && g->g_ops->grabbed ) { (*g->g_ops->grabbed)(g->g_priv); return; } } if ( NULL == g->g_ops || NULL == g->g_ops->keypress ) return; (*g->g_ops->keypress)(g->g_priv, key, down); }