2011-07-28 14:26:00 +00:00
|
|
|
|
2011-05-31 17:10:21 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2011 Skia
|
2011-05-31 17:10:21 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2011-05-31 17:10:21 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2011-05-31 17:10:21 +00:00
|
|
|
#ifndef _ANDROID_TO_SKIA_KEYCODES_H
|
|
|
|
#define _ANDROID_TO_SKIA_KEYCODES_H
|
|
|
|
|
2011-06-13 16:58:40 +00:00
|
|
|
#include "android/keycodes.h"
|
2011-05-31 17:10:21 +00:00
|
|
|
#include "SkKey.h"
|
|
|
|
|
|
|
|
// Convert an Android keycode to an SkKey. This is an incomplete list, only
|
|
|
|
// including keys used by the sample app.
|
|
|
|
SkKey AndroidKeycodeToSkKey(int keycode) {
|
|
|
|
switch (keycode) {
|
|
|
|
case AKEYCODE_DPAD_LEFT:
|
|
|
|
return kLeft_SkKey;
|
|
|
|
case AKEYCODE_DPAD_RIGHT:
|
|
|
|
return kRight_SkKey;
|
|
|
|
case AKEYCODE_DPAD_UP:
|
|
|
|
return kUp_SkKey;
|
|
|
|
case AKEYCODE_DPAD_DOWN:
|
|
|
|
return kDown_SkKey;
|
2011-06-13 16:58:40 +00:00
|
|
|
case AKEYCODE_BACK:
|
|
|
|
return kBack_SkKey;
|
2011-05-31 17:10:21 +00:00
|
|
|
default:
|
|
|
|
return kNONE_SkKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|