| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2011 Skia | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 | |
| 9 #ifndef _ANDROID_TO_SKIA_KEYCODES_H | |
| 10 #define _ANDROID_TO_SKIA_KEYCODES_H | |
| 11 | |
| 12 #include "android/keycodes.h" | |
| 13 #include "SkKey.h" | |
| 14 | |
| 15 // Convert an Android keycode to an SkKey. This is an incomplete list, only | |
| 16 // including keys used by the sample app. | |
| 17 SkKey AndroidKeycodeToSkKey(int keycode) { | |
| 18 switch (keycode) { | |
| 19 case AKEYCODE_DPAD_LEFT: | |
| 20 return kLeft_SkKey; | |
| 21 case AKEYCODE_DPAD_RIGHT: | |
| 22 return kRight_SkKey; | |
| 23 case AKEYCODE_DPAD_UP: | |
| 24 return kUp_SkKey; | |
| 25 case AKEYCODE_DPAD_DOWN: | |
| 26 return kDown_SkKey; | |
| 27 case AKEYCODE_BACK: | |
| 28 return kBack_SkKey; | |
| 29 default: | |
| 30 return kNONE_SkKey; | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 #endif | |
| OLD | NEW |