add kbm support

This commit is contained in:
2026-08-13 09:11:13 +03:00
parent fb2e8eefd9
commit 7c7386099a
62 changed files with 1036 additions and 134 deletions
+36 -2
View File
@@ -22,6 +22,8 @@ Input::Input()
void Input::tick(LocalPlayer *player)
{
if(!InputManager.IsMouseCaptured())
InputManager.SetMouseCaptured(true);
// 4J Stu - Assume that we only need one input class, even though the java has subclasses for keyboard/controller
// This function is based on the ControllerInput class in the Java, and will probably need changed
//OutputDebugString("INPUT: Beginning input tick\n");
@@ -40,6 +42,14 @@ void Input::tick(LocalPlayer *player)
else
ya = 0.0f;
#ifdef _WINDOWS64
if (InputManager.IsKeyDown('A')) xa = 1.0f;
else if (InputManager.IsKeyDown('D')) xa = -1.0f;
if (InputManager.IsKeyDown('W')) ya = 1.0f;
else if (InputManager.IsKeyDown('S')) ya = -1.0f;
#endif
#ifndef _CONTENT_PACKAGE
if (app.GetFreezePlayers())
{
@@ -99,8 +109,26 @@ void Input::tick(LocalPlayer *player)
}
tx = ty = 0.0f;
}
player->interpolateTurn(tx * abs(tx) * turnSpeed, ty * abs(ty) * turnSpeed);
float turnX = tx * abs(tx) * turnSpeed;
float turnY = ty * abs(ty) * turnSpeed;
#ifdef _WINDOWS64
//if (InputManager.IsMouseCaptured())
{
float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f;
float mx = (float)InputManager.GetRawMouseX() * (mouseSensitivity * 5.0f);
float my = -(float)InputManager.GetRawMouseY() * (mouseSensitivity * 5.0f);
if ( app.GetGameSettings(iPad,eGameSetting_ControlInvertLook) )
my = -my;
turnX += mx;
turnY += my;
}
//else
#endif
player->interpolateTurn(turnX, turnY);
//jumping = controller.isButtonPressed(0);
@@ -110,6 +138,12 @@ void Input::tick(LocalPlayer *player)
else
jumping = false;
#ifdef _WINDOWS64
if (InputManager.IsKeyDown(VK_SPACE)) jumping = true;
if (InputManager.IsKeyDown(VK_SHIFT)) sneaking = true;
else sneaking = false;
#endif
#ifndef _CONTENT_PACKAGE
if (app.GetFreezePlayers()) jumping = false;
#endif