mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Added input overlay
This commit is contained in:
@@ -252,6 +252,12 @@ void EmulatedController::clear_controllers()
|
||||
|
||||
float EmulatedController::get_axis_value(uint64 mapping) const
|
||||
{
|
||||
const auto overridenAxisMappingIt = m_overridenAxisMappings.find(mapping);
|
||||
if (overridenAxisMappingIt != m_overridenAxisMappings.cend() && overridenAxisMappingIt->second != 0.0f)
|
||||
{
|
||||
return overridenAxisMappingIt->second;
|
||||
}
|
||||
|
||||
const auto it = m_mappings.find(mapping);
|
||||
if (it != m_mappings.cend())
|
||||
{
|
||||
@@ -263,8 +269,26 @@ float EmulatedController::get_axis_value(uint64 mapping) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EmulatedController::setButtonValue(uint64 mapping, bool value)
|
||||
{
|
||||
std::shared_lock lock(m_mutex);
|
||||
m_overridenButtonMappings[mapping] = value;
|
||||
|
||||
}
|
||||
void EmulatedController::setAxisValue(uint64 mapping, float value)
|
||||
{
|
||||
std::shared_lock lock(m_mutex);
|
||||
m_overridenAxisMappings[mapping] = value;
|
||||
}
|
||||
|
||||
bool EmulatedController::is_mapping_down(uint64 mapping) const
|
||||
{
|
||||
const auto overridenButtonMappingIt = m_overridenButtonMappings.find(mapping);
|
||||
if (overridenButtonMappingIt != m_overridenButtonMappings.cend() && overridenButtonMappingIt->second)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto it = m_mappings.find(mapping);
|
||||
if (it != m_mappings.cend())
|
||||
{
|
||||
|
||||
@@ -100,7 +100,8 @@ public:
|
||||
bool was_home_button_down() { return std::exchange(m_homebutton_down, false); }
|
||||
|
||||
virtual bool set_default_mapping(const std::shared_ptr<ControllerBase>& controller) { return false; }
|
||||
|
||||
void setButtonValue(uint64 mapping, bool value);
|
||||
void setAxisValue(uint64 mapping, float value);
|
||||
protected:
|
||||
size_t m_player_index;
|
||||
std::string m_profile_name = "default";
|
||||
@@ -117,7 +118,9 @@ protected:
|
||||
uint64 button;
|
||||
};
|
||||
std::unordered_map<uint64, Mapping> m_mappings;
|
||||
|
||||
std::unordered_map<uint64, bool> m_overridenButtonMappings;
|
||||
std::unordered_map<uint64, float> m_overridenAxisMappings;
|
||||
|
||||
bool m_homebutton_down = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user