//------------------------------------------------------------------------- /* Copyright (C) 2010 EDuke32 developers and contributors This file is part of EDuke32. EDuke32 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- #include "ns.h" // Must come before everything else! #include "global.h" #include "game.h" #include "gamecontrol.h" #include "keyboard.h" #include "mouse.h" #include "joystick.h" #include "control.h" #include "input.h" #include "menus.h" BEGIN_DUKE_NS int32_t I_CheckAllInput(void) { return KB_KeyWaiting() || MOUSE_GetButtons() || JOYSTICK_GetButtons() #if defined EDUKE32_IOS || g_mouseClickState == MOUSE_PRESSED #endif ; } void I_ClearAllInput(void) { KB_FlushKeyboardQueue(); KB_ClearKeysDown(); MOUSE_ClearAllButtons(); JOYSTICK_ClearAllButtons(); CONTROL_ClearAllButtons(); #if defined EDUKE32_IOS mouseAdvanceClickState(); #endif } int32_t I_TextSubmit(void) { return KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) #if !defined EDUKE32_TOUCH_DEVICES || MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) #endif || (JOYSTICK_GetGameControllerButtons()&(1< 0) { inputloc--; *(t+inputloc) = 0; } } else { if (ch == asc_Enter) { I_AdvanceTriggerClear(); return 1; } else if (ch == asc_Escape) { I_ReturnTriggerClear(); return -1; } else if (ch >= 32 && inputloc < maxlength && ch < 127) { if (!(flags & INPUT_NUMERIC) || (ch >= '0' && ch <= '9')) { // JBF 20040508: so we can have numeric only if we want *(t+inputloc) = ch; *(t+inputloc+1) = 0; inputloc++; } } } } if (I_TextSubmit()) { I_TextSubmitClear(); return 1; } if (I_ReturnTrigger()) { I_ReturnTriggerClear(); return -1; } return 0; } END_DUKE_NS