Mouse improvements

Mouse look was previously being changed on Input::tick which only runs 20 times per second and then it was interpolated to make it feel better. I moved it to the WndProc function and stopped interpolating. I also changed the mouseLookScale to 1 because it was a lot faster than before.
This commit is contained in:
simon 2026-03-07 17:13:56 -08:00
parent d017bfc30a
commit de86a03a8a
2 changed files with 29 additions and 19 deletions

View file

@ -164,25 +164,6 @@ void Input::tick(LocalPlayer *player)
player->interpolateTurn(tx* abs(tx)* turnSpeed, ty* abs(ty)* turnSpeed);
#ifdef _WINDOWS64
if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{
int dx = g_KBMInput.GetRawDeltaX();
int dy = g_KBMInput.GetRawDeltaY();
g_KBMInput.ConsumeMouseDelta();
if (dx != 0 || dy != 0)
{
float mouseSensitivity = ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f;
float mouseLookScale = 5.0f;
float mdx = dx * mouseSensitivity * mouseLookScale;
float mdy = -dy * mouseSensitivity * mouseLookScale;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
mdy = -mdy;
player->interpolateTurn(mdx, mdy);
}
}
#endif
//jumping = controller.isButtonPressed(0);
unsigned int jump = InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP);

View file

@ -493,6 +493,35 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
}
#ifdef _WINDOWS64
Minecraft* instance = Minecraft::GetInstance();
if (!instance)
break;
LocalPlayer* player = instance->localplayers[0].get();
if (!player)
break;
int iPad = player->GetXboxPad();
if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
{
int dx = g_KBMInput.GetRawDeltaX();
int dy = g_KBMInput.GetRawDeltaY();
g_KBMInput.ConsumeMouseDelta();
if (dx != 0 || dy != 0)
{
float mouseSensitivity = ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f;
float mouseLookScale = 1.0f;
float mdx = dx * mouseSensitivity * mouseLookScale;
float mdy = -dy * mouseSensitivity * mouseLookScale;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
mdy = -mdy;
instance->player->turn(mdx, mdy);
}
}
#endif
}
break;