michael@0: michael@0: /* michael@0: * Copyright 2011 Skia michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef _ANDROID_TO_SKIA_KEYCODES_H michael@0: #define _ANDROID_TO_SKIA_KEYCODES_H michael@0: michael@0: #include "android/keycodes.h" michael@0: #include "SkKey.h" michael@0: michael@0: // Convert an Android keycode to an SkKey. This is an incomplete list, only michael@0: // including keys used by the sample app. michael@0: SkKey AndroidKeycodeToSkKey(int keycode) { michael@0: switch (keycode) { michael@0: case AKEYCODE_DPAD_LEFT: michael@0: return kLeft_SkKey; michael@0: case AKEYCODE_DPAD_RIGHT: michael@0: return kRight_SkKey; michael@0: case AKEYCODE_DPAD_UP: michael@0: return kUp_SkKey; michael@0: case AKEYCODE_DPAD_DOWN: michael@0: return kDown_SkKey; michael@0: case AKEYCODE_BACK: michael@0: return kBack_SkKey; michael@0: default: michael@0: return kNONE_SkKey; michael@0: } michael@0: } michael@0: michael@0: #endif