MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ApplyDefaultXInputBindings

Function ApplyDefaultXInputBindings

TombEngine/Specific/Input/Input.cpp:744–779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742 }
743
744 bool ApplyDefaultXInputBindings()
745 {
746 if (!OisGamepad)
747 return false;
748
749 for (int i = 0; i < (int)ActionID::Count; i++)
750 {
751 auto actionID = (ActionID)i;
752
753 int defaultKeyID = g_Bindings.GetBoundKeyID(BindingProfileID::Default, actionID);
754 int userKeyID = g_Bindings.GetBoundKeyID(BindingProfileID::Custom, actionID);
755
756 if (userKeyID != OIS::KC_UNASSIGNED &&
757 userKeyID != defaultKeyID)
758 {
759 return false;
760 }
761 }
762
763 auto vendor = ToLower(OisGamepad->vendor());
764 if (vendor.find("xbox") != std::string::npos || vendor.find("xinput") != std::string::npos)
765 {
766 ApplyBindings(DEFAULT_GAMEPAD_BINDING_PROFILE);
767 g_Configuration.Bindings = g_Bindings.GetBindingProfile(BindingProfileID::Custom);
768
769 // Additionally enable rumble and thumbstick camera.
770 g_Configuration.EnableRumble = true;
771 g_Configuration.EnableThumbstickCamera = true;
772
773 return true;
774 }
775 else
776 {
777 return false;
778 }
779 }
780
781 Vector2 GetMouse2DPosition()
782 {

Callers 2

InitializeInputFunction · 0.85
ApplyDefaultBindingsFunction · 0.85

Calls 4

ToLowerFunction · 0.85
ApplyBindingsFunction · 0.85
GetBoundKeyIDMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected