Fixed warning C4244: 'function': conversion from 'Uint16' to 'Uint8', possible loss of data

This commit is contained in:
Sam Lantinga 2024-05-10 16:09:11 -07:00
parent c64d7ed0aa
commit 8582bdaab8
1 changed files with 5 additions and 5 deletions

View File

@ -715,27 +715,27 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
}
if (hwdata->changes & AXES_CHANGED) {
for (Uint16 i = 0; i < hwdata->desc.naxes; ++i) {
for (Uint8 i = 0; i < hwdata->desc.naxes; ++i) {
SDL_SendJoystickAxis(timestamp, joystick, i, hwdata->axes[i]);
}
}
if (hwdata->changes & BALLS_CHANGED) {
for (Uint16 i = 0; i < hwdata->desc.nballs; ++i) {
for (Uint8 i = 0; i < hwdata->desc.nballs; ++i) {
SDL_JoystickBallData *ball = &hwdata->balls[i];
if (ball->dx || ball->dy) {
SDL_SendJoystickBall(timestamp, joystick, i, ball->dx, ball->dy);
SDL_SendJoystickBall(timestamp, joystick, i, (Sint16)ball->dx, (Sint16)ball->dy);
ball->dx = 0;
ball->dy = 0;
}
}
}
if (hwdata->changes & BUTTONS_CHANGED) {
for (Uint16 i = 0; i < hwdata->desc.nbuttons; ++i) {
for (Uint8 i = 0; i < hwdata->desc.nbuttons; ++i) {
SDL_SendJoystickButton(timestamp, joystick, i, hwdata->buttons[i]);
}
}
if (hwdata->changes & HATS_CHANGED) {
for (Uint16 i = 0; i < hwdata->desc.nhats; ++i) {
for (Uint8 i = 0; i < hwdata->desc.nhats; ++i) {
SDL_SendJoystickHat(timestamp, joystick, i, hwdata->hats[i]);
}
}