diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-06 16:38:44 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-06 16:38:44 (EDT) |
commit | 213e8511db7356ce3abb852fc437797f252308d0 (patch) | |
tree | e1908aaf14e210d523ad009e7838d60a64a7d01f /src | |
parent | 94fde9dad4d2c9ef179289ef52d2a629d9d3977a (diff) | |
download | mazefight-213e8511db7356ce3abb852fc437797f252308d0.zip mazefight-213e8511db7356ce3abb852fc437797f252308d0.tar.gz mazefight-213e8511db7356ce3abb852fc437797f252308d0.tar.bz2 |
tk: Add check key handling
Diffstat (limited to 'src')
-rw-r--r-- | src/tk/check.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tk/check.c b/src/tk/check.c index 407d969..fddd7cf 100644 --- a/src/tk/check.c +++ b/src/tk/check.c @@ -85,7 +85,22 @@ _mftk_check_key_event(struct mftk_widget *w, SDL_Event *e) { struct mftk_check *c = (struct mftk_check *) w; - /* TODO */ + switch (e->type) { + case SDL_KEYDOWN: + switch (e->key.keysym.sym) { + case SDLK_SPACE: + case SDLK_RETURN: + c->state = !c->state; + if (c->action == NULL) { + return 0; + } + return c->action(c->user_data,c->state); + default: + break; + } + default: + break; + } return 0; } |