Add in analog stick control handling. Add interface configuration file.

This commit is contained in:
Nic0Nic0Nii
2024-01-19 15:20:38 +00:00
parent 7cf44b2462
commit df08aa9936
7 changed files with 49 additions and 7 deletions
+21
View File
@@ -125,6 +125,27 @@ bool Input::Released(){
return false;
}
float Input::Analog(){
if(!game->IsFocused())return false;
switch(type){
case ANALOG:{
for(GamePad*gamepad:GamePad::getGamepads()){
if(gamepad->stillConnected){
float axisVal=gamepad->getAxis(static_cast<GPAxes>(key));
if(axisVal!=0.f){
usingGamepad=true;
return axisVal;
}
}
}
}break;
default:{
ERR("Invalid Control Scheme detected for analog controls! We shouldn't be here!! Type is "<<type);
}
}
return 0.f;
}
std::string Input::GetDisplayName(){
return GenericKey::keyLiteral.at({type,key});
}