paulo@0: /* PC joystick code paulo@0: paulo@0: Copyright (C) 2006 Damian Yerrick paulo@0: paulo@0: This work is free software; you can redistribute it and/or modify paulo@0: it under the terms of the GNU General Public License as published by paulo@0: the Free Software Foundation; either version 2 of the License, or paulo@0: (at your option) any later version. paulo@0: paulo@0: This program is distributed in the hope that it will be useful, paulo@0: but WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the paulo@0: GNU General Public License for more details. paulo@0: paulo@0: You should have received a copy of the GNU General Public License paulo@0: along with this program; if not, write to the Free Software paulo@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA paulo@0: paulo@0: Original game concept and design by Alexey Pajitnov. paulo@0: The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg, paulo@0: or The Tetris Company LLC. paulo@0: paulo@0: */ paulo@0: paulo@0: #ifndef PCJOY_H paulo@0: #define PCJOY_H paulo@0: paulo@0: #include "ljtypes.h" paulo@0: #include "ljcontrol.h" paulo@0: paulo@0: paulo@0: /* Physical key definitions paulo@0: paulo@0: m.joy < 0: paulo@0: key[m.axis] paulo@0: m.joy >= 0, m.stick < 0: paulo@0: joy[m.joy].button[m.axis].b paulo@0: m.joy >= 0, m.stick >= 0, m.axis < 0: paulo@0: joy[m.joy].stick[m.stick].axis[~m.axis].d1 paulo@0: m.joy >= 0, m.stick >= 0, m.axis >= 0: paulo@0: joy[m.joy].stick[m.stick].axis[m.axis].d2 paulo@0: */ paulo@0: paulo@0: struct pkeyMapping { paulo@0: signed char joy; paulo@0: signed char stick; paulo@0: signed char axis; paulo@0: }; paulo@0: paulo@0: extern volatile int wantsClose; paulo@0: paulo@0: void initKeys(void); paulo@0: paulo@0: /** paulo@0: * Reads the physical keys to produce a set of pressed virtual keys. paulo@0: */ paulo@0: LJBits readPad(unsigned int player); paulo@0: paulo@0: /** paulo@0: * Reads the physical keys to produce a set of pressed virtual keys, paulo@0: * hardcoding keyboard Up, Down, Left, Right, Esc, and Enter paulo@0: * to the appropriate vkeys. paulo@0: */ paulo@0: LJBits menuReadPad(void); paulo@0: paulo@0: void getPkeyName(char *dst, int j, int s, int a); paulo@0: extern const char *const vkeyNames[]; paulo@0: void configureKeys(void); paulo@0: paulo@0: #endif