Merge branch 'gsoc-android-2' of git+ssh://repo.or.cz/srv/git/kugel-rb into gsoc...
[kugel-rb.git] / uisimulator / buttonmap / iaudio-x5_m5.c
blob9bab1df94bab3edd529c6bc11a299ea126c8d6e1
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Barry Wardell
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include <SDL.h>
24 #include "button.h"
25 #include "config.h"
26 #include "buttonmap.h"
28 int key_to_button(int keyboard_button)
30 int new_btn = BUTTON_NONE;
31 switch (keyboard_button)
33 case SDLK_KP4:
34 case SDLK_LEFT:
35 new_btn = BUTTON_LEFT;
36 break;
37 case SDLK_KP6:
38 case SDLK_RIGHT:
39 new_btn = BUTTON_RIGHT;
40 break;
41 case SDLK_KP8:
42 case SDLK_UP:
43 new_btn = BUTTON_UP;
44 break;
45 case SDLK_KP2:
46 case SDLK_DOWN:
47 new_btn = BUTTON_DOWN;
48 break;
49 case SDLK_KP_PLUS:
50 case SDLK_F8:
51 new_btn = BUTTON_PLAY;
52 break;
53 case SDLK_ESCAPE:
54 new_btn = BUTTON_POWER;
55 break;
56 case SDLK_KP_ENTER:
57 case SDLK_RETURN:
58 case SDLK_a:
59 new_btn = BUTTON_POWER;
60 break;
61 case SDLK_KP_DIVIDE:
62 case SDLK_F1:
63 new_btn = BUTTON_REC;
64 break;
65 case SDLK_KP5:
66 case SDLK_SPACE:
67 new_btn = BUTTON_SELECT;
68 break;
70 return new_btn;
73 struct button_map bm[] = {
74 #if defined (IAUDIO_M5)
75 { SDLK_KP_ENTER, 333, 41, 17, "Enter" },
76 { SDLK_h, 334, 74, 21, "Hold" },
77 { SDLK_KP_DIVIDE, 333, 142, 24, "Record" },
78 { SDLK_KP_PLUS, 332, 213, 20, "Play" },
79 { SDLK_KP5, 250, 291, 19, "Select" },
80 { SDLK_KP8, 249, 236, 32, "Up" },
81 { SDLK_KP4, 194, 292, 29, "Left" },
82 { SDLK_KP6, 297, 290, 27, "Right" },
83 { SDLK_KP2, 252, 335, 28, "Down" },
84 #elif defined (IAUDIO_X5)
85 { SDLK_KP_ENTER, 275, 38, 17, "Power" },
86 { SDLK_h, 274, 83, 16, "Hold" },
87 { SDLK_KP_DIVIDE, 276, 128, 22, "Record" },
88 { SDLK_KP_PLUS, 274, 186, 22, "Play" },
89 { SDLK_KP5, 200, 247, 16, "Select" },
90 { SDLK_KP8, 200, 206, 16, "Up" },
91 { SDLK_KP4, 163, 248, 19, "Left" },
92 { SDLK_KP6, 225, 247, 24, "Right" },
93 { SDLK_KP2, 199, 279, 20, "Down" },
94 #endif
95 { 0, 0, 0, 0, "None" }