blob: 6bcb148b46cf2055fa1d95ccf547fe2d62f11723 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
Scroggof33d1532011-05-31 17:10:21 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Skia
Scroggof33d1532011-05-31 17:10:21 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
Scroggof33d1532011-05-31 17:10:21 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
Scroggof33d1532011-05-31 17:10:21 +000010#ifndef _ANDROID_TO_SKIA_KEYCODES_H
11#define _ANDROID_TO_SKIA_KEYCODES_H
12
djsollen@google.come32b5832011-06-13 16:58:40 +000013#include "android/keycodes.h"
Scroggof33d1532011-05-31 17:10:21 +000014#include "SkKey.h"
15
16// Convert an Android keycode to an SkKey. This is an incomplete list, only
17// including keys used by the sample app.
18SkKey AndroidKeycodeToSkKey(int keycode) {
19 switch (keycode) {
20 case AKEYCODE_DPAD_LEFT:
21 return kLeft_SkKey;
22 case AKEYCODE_DPAD_RIGHT:
23 return kRight_SkKey;
24 case AKEYCODE_DPAD_UP:
25 return kUp_SkKey;
26 case AKEYCODE_DPAD_DOWN:
27 return kDown_SkKey;
djsollen@google.come32b5832011-06-13 16:58:40 +000028 case AKEYCODE_BACK:
29 return kBack_SkKey;
Scroggof33d1532011-05-31 17:10:21 +000030 default:
31 return kNONE_SkKey;
32 }
33}
34
35#endif