graphics

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit b82e93101ef1964bf39f85a5a6699ee52ceb7532
parent 0de2dafd8e8995c85a479458aee0c2c4413de757
Author: Brian Swetland <swetland@frotz.net>
Date:   Sat,  6 Jul 2013 01:07:05 -0700

common: onKeyDown() and onKeyUp() callbacks

Diffstat:
Mcommon/app.h | 2++
Mcommon/glapp.cc | 2++
2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common/app.h b/common/app.h @@ -155,6 +155,8 @@ public: virtual int init(void) = 0; virtual void render(void) = 0; virtual void release(void) {}; + virtual void onKeyDown(unsigned code) {}; + virtual void onKeyUp(unsigned code) {}; /* glue - do not use */ int start(void); diff --git a/common/glapp.cc b/common/glapp.cc @@ -59,10 +59,12 @@ void App::handleEvents(void) { keystate[code >> 5] |= (1 << (code & 0x1F)); if (code == SDL_SCANCODE_ESCAPE) quit(); + onKeyDown(code); break; case SDL_KEYUP: code = ev.key.keysym.scancode; keystate[code >> 5] &= ~(1 << (code & 0x1F)); + onKeyUp(code); break; case SDL_QUIT: quit();