mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-08-11 04:52:26 +00:00
Uncap FPS, disable VSync, check for mouse input per frame and improve nanoTime precision.
This commit is contained in:
parent
eccd785110
commit
c712b07fc3
|
|
@ -162,29 +162,27 @@ void Input::tick(LocalPlayer *player)
|
||||||
tx = ty = 0.0f;
|
tx = ty = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float turnX = tx * abs(tx) * turnSpeed;
|
player->interpolateTurn(tx* abs(tx)* turnSpeed, ty* abs(ty)* turnSpeed);
|
||||||
float turnY = ty * abs(ty) * turnSpeed;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
|
if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
|
||||||
{
|
{
|
||||||
float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f;
|
int dx = g_KBMInput.GetRawDeltaX();
|
||||||
float mouseLookScale = 5.0f;
|
int dy = g_KBMInput.GetRawDeltaY();
|
||||||
float mx = g_KBMInput.GetLookX(mouseSensitivity * mouseLookScale);
|
g_KBMInput.ConsumeMouseDelta();
|
||||||
float my = g_KBMInput.GetLookY(mouseSensitivity * mouseLookScale);
|
if (dx != 0 || dy != 0)
|
||||||
|
|
||||||
if ( app.GetGameSettings(iPad,eGameSetting_ControlInvertLook) )
|
|
||||||
{
|
{
|
||||||
my = -my;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
turnX += mx;
|
|
||||||
turnY += my;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
player->interpolateTurn(turnX, turnY);
|
|
||||||
|
|
||||||
//jumping = controller.isButtonPressed(0);
|
//jumping = controller.isButtonPressed(0);
|
||||||
|
|
||||||
unsigned int jump = InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP);
|
unsigned int jump = InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP);
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ public:
|
||||||
float GetLookX(float sensitivity) const;
|
float GetLookX(float sensitivity) const;
|
||||||
float GetLookY(float sensitivity) const;
|
float GetLookY(float sensitivity) const;
|
||||||
|
|
||||||
|
int GetRawDeltaX() const { return m_mouseDeltaAccumX; }
|
||||||
|
int GetRawDeltaY() const { return m_mouseDeltaAccumY; }
|
||||||
|
void ConsumeMouseDelta() { m_mouseDeltaAccumX = 0; m_mouseDeltaAccumY = 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_keyDown[MAX_KEYS];
|
bool m_keyDown[MAX_KEYS];
|
||||||
bool m_keyDownPrev[MAX_KEYS];
|
bool m_keyDownPrev[MAX_KEYS];
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ void Options::init()
|
||||||
bobView = true;
|
bobView = true;
|
||||||
anaglyph3d = false;
|
anaglyph3d = false;
|
||||||
advancedOpengl = false;
|
advancedOpengl = false;
|
||||||
framerateLimit = 2;
|
framerateLimit = 0;
|
||||||
fancyGraphics = true;
|
fancyGraphics = true;
|
||||||
ambientOcclusion = true;
|
ambientOcclusion = true;
|
||||||
renderClouds = true;
|
renderClouds = true;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "..\..\Minecraft.World\Vec3.h"
|
#include "..\..\Minecraft.World\Vec3.h"
|
||||||
#include "..\..\Minecraft.World\Level.h"
|
#include "..\..\Minecraft.World\Level.h"
|
||||||
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.h"
|
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||||
|
#include "..\MultiplayerLocalPlayer.h"
|
||||||
|
|
||||||
#include "..\ClientConnection.h"
|
#include "..\ClientConnection.h"
|
||||||
#include "..\User.h"
|
#include "..\User.h"
|
||||||
|
|
@ -265,7 +266,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice,
|
||||||
pd3dPP->EnableAutoDepthStencil = TRUE;
|
pd3dPP->EnableAutoDepthStencil = TRUE;
|
||||||
pd3dPP->AutoDepthStencilFormat = D3DFMT_D24S8;
|
pd3dPP->AutoDepthStencilFormat = D3DFMT_D24S8;
|
||||||
pd3dPP->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
pd3dPP->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
pd3dPP->PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
pd3dPP->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||||
//pd3dPP->Flags = D3DPRESENTFLAG_NO_LETTERBOX;
|
//pd3dPP->Flags = D3DPRESENTFLAG_NO_LETTERBOX;
|
||||||
//ERR[D3D]: Can't set D3DPRESENTFLAG_NO_LETTERBOX when wide-screen is enabled
|
//ERR[D3D]: Can't set D3DPRESENTFLAG_NO_LETTERBOX when wide-screen is enabled
|
||||||
// in the launcher/dashboard.
|
// in the launcher/dashboard.
|
||||||
|
|
@ -760,8 +761,6 @@ void CleanupDevice()
|
||||||
if( g_pd3dDevice ) g_pd3dDevice->Release();
|
if( g_pd3dDevice ) g_pd3dDevice->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
_In_opt_ HINSTANCE hPrevInstance,
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
_In_ LPTSTR lpCmdLine,
|
_In_ LPTSTR lpCmdLine,
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,14 @@ void System::arraycopy(arrayWithLength<int> src, unsigned int srcPos, arrayWithL
|
||||||
//The current value of the system timer, in nanoseconds.
|
//The current value of the system timer, in nanoseconds.
|
||||||
__int64 System::nanoTime()
|
__int64 System::nanoTime()
|
||||||
{
|
{
|
||||||
return GetTickCount() * 1000000LL;
|
static LARGE_INTEGER s_frequency = { 0 };
|
||||||
|
if (s_frequency.QuadPart == 0)
|
||||||
|
QueryPerformanceFrequency(&s_frequency);
|
||||||
|
|
||||||
|
LARGE_INTEGER counter;
|
||||||
|
QueryPerformanceCounter(&counter);
|
||||||
|
|
||||||
|
return (__int64)((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond,
|
//Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue