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

Fix PS gyro for values at the boundaries #17

Merged

Conversation

ABeltramo
Copy link
Member

Comment on lines 368 to 372
if (value < SHRT_MIN) {
value = SHRT_MIN;
} else if (value > SHRT_MAX) {
value = SHRT_MAX;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (value < SHRT_MIN) {
value = SHRT_MIN;
} else if (value > SHRT_MAX) {
value = SHRT_MAX;
}
value = std::clamp(value, SHRT_MIN, SHRT_MAX);

Could you simplify to this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Kind of, you'll have to cast to float because SHRT_MIN/MAX are unsigned int.
I agree though it looks cleaner using clamp, I'm going to commit that!

@ABeltramo
Copy link
Member Author

I've tested this out a bit in-game, and it seems to work as it used to without the PR (at least on my setup).
So I'm going to merge it, hopefully it helps others fixing issues on other setups!

@ABeltramo ABeltramo merged commit 8065aeb into games-on-whales:stable Nov 14, 2024
1 check passed
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.

2 participants