1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
25 #include "buttonmap.h"
27 int key_to_button(int keyboard_button
)
29 int new_btn
= BUTTON_NONE
;
30 switch (keyboard_button
)
34 new_btn
= BUTTON_LEFT
;
38 new_btn
= BUTTON_RIGHT
;
46 new_btn
= BUTTON_DOWN
;
50 new_btn
= BUTTON_PLAYPAUSE
;
53 new_btn
= BUTTON_BACK
;
59 new_btn
= BUTTON_SELECT
;
62 new_btn
= BUTTON_VOL_UP
;
65 new_btn
= BUTTON_VOL_DOWN
;
68 new_btn
= BUTTON_POWER
;
71 new_btn
= BUTTON_BOTTOMLEFT
;
74 new_btn
= BUTTON_BOTTOMRIGHT
;
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" }