mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-04-23 15:33:58 +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,28 +162,26 @@ void Input::tick(LocalPlayer *player)
|
|||
tx = ty = 0.0f;
|
||||
}
|
||||
|
||||
float turnX = tx * abs(tx) * turnSpeed;
|
||||
float turnY = ty * abs(ty) * turnSpeed;
|
||||
player->interpolateTurn(tx* abs(tx)* turnSpeed, ty* abs(ty)* turnSpeed);
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
|
||||
{
|
||||
float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f;
|
||||
float mouseLookScale = 5.0f;
|
||||
float mx = g_KBMInput.GetLookX(mouseSensitivity * mouseLookScale);
|
||||
float my = g_KBMInput.GetLookY(mouseSensitivity * mouseLookScale);
|
||||
|
||||
if ( app.GetGameSettings(iPad,eGameSetting_ControlInvertLook) )
|
||||
int dx = g_KBMInput.GetRawDeltaX();
|
||||
int dy = g_KBMInput.GetRawDeltaY();
|
||||
g_KBMInput.ConsumeMouseDelta();
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
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
|
||||
|
||||
player->interpolateTurn(turnX, turnY);
|
||||
|
||||
//jumping = controller.isButtonPressed(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ public:
|
|||
float GetLookX(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:
|
||||
bool m_keyDown[MAX_KEYS];
|
||||
bool m_keyDownPrev[MAX_KEYS];
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ void Options::init()
|
|||
bobView = true;
|
||||
anaglyph3d = false;
|
||||
advancedOpengl = false;
|
||||
framerateLimit = 2;
|
||||
framerateLimit = 0;
|
||||
fancyGraphics = true;
|
||||
ambientOcclusion = true;
|
||||
renderClouds = true;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "..\..\Minecraft.World\Vec3.h"
|
||||
#include "..\..\Minecraft.World\Level.h"
|
||||
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
#include "..\MultiplayerLocalPlayer.h"
|
||||
|
||||
#include "..\ClientConnection.h"
|
||||
#include "..\User.h"
|
||||
|
|
@ -265,7 +266,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice,
|
|||
pd3dPP->EnableAutoDepthStencil = TRUE;
|
||||
pd3dPP->AutoDepthStencilFormat = D3DFMT_D24S8;
|
||||
pd3dPP->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
pd3dPP->PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
pd3dPP->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
//pd3dPP->Flags = D3DPRESENTFLAG_NO_LETTERBOX;
|
||||
//ERR[D3D]: Can't set D3DPRESENTFLAG_NO_LETTERBOX when wide-screen is enabled
|
||||
// in the launcher/dashboard.
|
||||
|
|
@ -760,8 +761,6 @@ void CleanupDevice()
|
|||
if( g_pd3dDevice ) g_pd3dDevice->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_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.
|
||||
__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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue