Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify controllers #793

Merged

Conversation

briaguya-ai
Copy link
Collaborator

@briaguya-ai briaguya-ai commented Jan 19, 2025

resolves #792

soh testing pr:

//todo

  • decide if there's a better way to handle the little vector thing simplify controllers #793 (comment)
  • filter devices by port simplify controllers #793 (comment)
    • i think 96e7d20 is good enough for now - once we start trying to account for edge cases we add complexity to what should be happy paths. i'm trying to avoid that because that's how we got to the point of needing the massive simplification in the first place.
  • actually test the built-in input editor window (i've made sure all the changes i made to the soh one made it over but i've only tested the soh input editor window)
    • works as expected

Comment on lines +25 to +40
// todo: i don't like making a vector here, not sure what a better solution is
std::vector<float> normalizedValues = {};
for (const auto& [instanceId, gamepad] :
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
mPortIndex)) {
const auto axisValue = SDL_GameControllerGetAxis(gamepad, mControllerAxis);

if ((mAxisDirection == POSITIVE && axisValue < 0) || (mAxisDirection == NEGATIVE && axisValue > 0)) {
normalizedValues.push_back(0.0f);
continue;
}

// scale {-32768 ... +32767} to {-MAX_AXIS_RANGE ... +MAX_AXIS_RANGE}
// and use the absolute value of it
normalizedValues.push_back(fabs(axisValue * MAX_AXIS_RANGE / MAX_SDL_RANGE));
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what to do about this one

@briaguya-ai briaguya-ai marked this pull request as ready for review January 20, 2025 00:52
@briaguya-ai briaguya-ai merged commit 82a3406 into Kenix3:main Jan 20, 2025
5 checks passed
This was referenced Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

simplify controllers
2 participants