keyboard.cpp
1 /* 2 * keyboard.c 3 * MACT library -to- JonoF's Build Port Keyboard Glue 4 * 5 * by Jonathon Fowler 6 * 7 * Since we don't have the source to the MACT library I've had to 8 * concoct some magic to glue its idea of controllers into that of 9 * my Build port. 10 * 11 */ 12 //------------------------------------------------------------------------- 13 /* 14 Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment 15 16 This file is part of Duke Nukem 3D version 1.5 - Atomic Edition 17 18 Duke Nukem 3D is free software; you can redistribute it and/or 19 modify it under the terms of the GNU General Public License 20 as published by the Free Software Foundation; either version 2 21 of the License, or (at your option) any later version. 22 23 This program is distributed in the hope that it will be useful, 24 but WITHOUT ANY WARRANTY; without even the implied warranty of 25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 26 27 See the GNU General Public License for more details. 28 29 You should have received a copy of the GNU General Public License 30 along with this program; if not, write to the Free Software 31 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 32 */ 33 //------------------------------------------------------------------------- 34 35 #include "compat.h" 36 37 #include "keyboard.h" 38 #include "control.h" 39 40 kb_scancode KB_LastScan; 41 42 // this is horrible! 43 const char *KB_ScanCodeToString(kb_scancode scancode) 44 { 45 for (auto &s : sctokeylut) 46 if (s.sc == scancode) 47 return s.key; 48 49 return ""; 50 } 51 52 kb_scancode KB_StringToScanCode(const char * string) 53 { 54 for (auto &s : sctokeylut) 55 if (!Bstrcasecmp(s.key, string)) 56 return s.sc; 57 58 return 0; 59 }