MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / isPressed

Method isPressed

src/Core/Input/InputButton.cpp:81–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79 }
80
81 bool InputButton::isPressed() const
82 {
83 if (m_type == InputType::Mouse)
84 return sf::Mouse::isButtonPressed(std::get<sf::Mouse::Button>(m_button));
85 if (m_type == InputType::GamepadButton)
86 return sf::Joystick::isButtonPressed(
87 m_gamepadIndex, std::get<unsigned int>(m_button));
88 if (m_type == InputType::GamepadAxis)
89 {
90 const float axisValue = sf::Joystick::getAxisPosition(
91 m_gamepadIndex, std::get<sf::Joystick::Axis>(m_button));
92 return (m_detectAxis.first == AxisThresholdDirection::Less)
93 ? axisValue < m_detectAxis.second
94 : axisValue > m_detectAxis.second;
95 }
96
97 return sf::Keyboard::isKeyPressed(std::get<sf::Keyboard::Key>(m_button));
98 }
99
100 float InputButton::getAxisPosition()
101 {

Callers 3

updateMethod · 0.45
updateMethod · 0.45
getPressedInputsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected