fuze+: correct UI simulator button map
[maemo-rb.git] / uisimulator / buttonmap / sansa-fuzeplus.c
blobef50009a356fce68666256ad3c29e1abb93b8561
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2011 by Amaury Pouly
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 "buttonmap.h"
27 int key_to_button(int keyboard_button)
29 int new_btn = BUTTON_NONE;
30 switch (keyboard_button)
32 case SDLK_KP4:
33 case SDLK_LEFT:
34 new_btn = BUTTON_LEFT;
35 break;
36 case SDLK_KP6:
37 case SDLK_RIGHT:
38 new_btn = BUTTON_RIGHT;
39 break;
40 case SDLK_KP8:
41 case SDLK_UP:
42 new_btn = BUTTON_UP;
43 break;
44 case SDLK_KP2:
45 case SDLK_DOWN:
46 new_btn = BUTTON_DOWN;
47 break;
48 case SDLK_PAGEUP:
49 case SDLK_KP9:
50 new_btn = BUTTON_PLAYPAUSE;
51 break;
52 case SDLK_KP7:
53 new_btn = BUTTON_BACK;
54 break;
55 case SDLK_KP5:
56 case SDLK_SPACE:
57 case SDLK_KP_ENTER:
58 case SDLK_RETURN:
59 new_btn = BUTTON_SELECT;
60 break;
61 case SDLK_KP_PLUS:
62 new_btn = BUTTON_VOL_UP;
63 break;
64 case SDLK_KP_MINUS:
65 new_btn = BUTTON_VOL_DOWN;
66 break;
67 case SDLK_HOME:
68 new_btn = BUTTON_POWER;
69 break;
70 case SDLK_KP1:
71 new_btn = BUTTON_BOTTOMLEFT;
72 break;
73 case SDLK_KP3:
74 new_btn = BUTTON_BOTTOMRIGHT;
75 break;
77 return new_btn;
80 struct button_map bm[] = {
81 { SDLK_KP7, 69, 401, 39, "Back" },
82 { SDLK_KP8, 161, 404, 34, "Up" },
83 { SDLK_KP9, 258, 400, 43, "Play/Pause" },
84 { SDLK_KP4, 69, 477, 36, "Left" },
85 { SDLK_KP5, 161, 476, 31, "Select" },
86 { SDLK_KP6, 222, 474, 41, "Right" },
87 { SDLK_KP1, 82, 535, 34, "Bottom-Left" },
88 { SDLK_KP2, 162, 532, 33, "Down" },
89 { SDLK_KP3, 234, 535, 42, "Bottom-Right" },
90 { SDLK_KP_PLUS, 1, 128, 29, "Vol+" },
91 { SDLK_KP_MINUS, 5, 187, 30, "Vol-" },
92 { SDLK_HOME, 170, 6, 50, "Power" },
93 { 0, 0, 0, 0, "None" }