/////////////////// // Returns if the input is down bool CInput::isDown() const { switch(Type) { // Keyboard case INP_KEYBOARD: if(wasDown()) return true; // in this case, we want to return true here to get it recognised at least once return bDown; // Mouse case INP_MOUSE: if(GetMouse()->Button & SDL_BUTTON(Data)) return true; break; #ifdef HAVE_JOYSTICK // Joystick case INP_JOYSTICK1: return checkJoystickState(Data, Extra, 0); case INP_JOYSTICK2: return checkJoystickState(Data, Extra, 1); #endif } return false; }
bool InputManager::clicked(const std::string& assignmentName) const { return (isDown(assignmentName) && !wasDown(assignmentName)); }