[Fix] Fixed some UI scrolling/zooming speeds.

This commit is contained in:
Rtch90 2018-01-19 19:42:44 +00:00
parent 9961d38782
commit 4abeef8f55
2 changed files with 16 additions and 14 deletions

View File

@ -75,18 +75,19 @@ void Player::TimeStepUpdate(const float timeStep) {
void Player::PollControls(void) { void Player::PollControls(void) {
int mouseMotion[2]; int mouseMotion[2];
const float frameTime = L3D::GetFrameTime();
float time_accel = L3D::GetTimeAccel(); float time_accel = L3D::GetTimeAccel();
float ta2 = time_accel*time_accel; float ta2 = time_accel*time_accel;
polledControlsThisTurn = true; polledControlsThisTurn = true;
if(L3D::GetCamType() == L3D::CAM_EXTERNAL) { if(L3D::GetCamType() == L3D::CAM_EXTERNAL) {
if(L3D::KeyState(SDLK_UP)) m_external_view_rotx -= 1; if(L3D::KeyState(SDLK_UP)) m_external_view_rotx -= 45*frameTime;
if(L3D::KeyState(SDLK_DOWN)) m_external_view_rotx += 1; if(L3D::KeyState(SDLK_DOWN)) m_external_view_rotx += 45*frameTime;
if(L3D::KeyState(SDLK_LEFT)) m_external_view_roty -= 1; if(L3D::KeyState(SDLK_LEFT)) m_external_view_roty -= 45*frameTime;
if(L3D::KeyState(SDLK_RIGHT)) m_external_view_roty += 1; if(L3D::KeyState(SDLK_RIGHT)) m_external_view_roty += 45*frameTime;
if(L3D::KeyState(SDLK_EQUALS)) m_external_view_dist -= 10; if(L3D::KeyState(SDLK_EQUALS)) m_external_view_dist -= 400*frameTime;
if(L3D::KeyState(SDLK_MINUS)) m_external_view_dist += 10; if(L3D::KeyState(SDLK_MINUS)) m_external_view_dist += 400*frameTime;
m_external_view_dist = MAX(50, m_external_view_dist); m_external_view_dist = MAX(50, m_external_view_dist);
/* When landed don't let external view look from below. */ /* When landed don't let external view look from below. */

View File

@ -170,14 +170,15 @@ void SectorView::DrawSector(int sx, int sy) {
} }
void SectorView::Update(void) { void SectorView::Update(void) {
if(L3D::KeyState(SDLK_LEFT)) m_px -= 0.01; const float frameTime = L3D::GetFrameTime();
if(L3D::KeyState(SDLK_RIGHT)) m_px += 0.01; if(L3D::KeyState(SDLK_LEFT)) m_px -= 1*frameTime;
if(L3D::KeyState(SDLK_UP)) m_py += 0.01; if(L3D::KeyState(SDLK_RIGHT)) m_px += 1*frameTime;
if(L3D::KeyState(SDLK_DOWN)) m_py -= 0.01; if(L3D::KeyState(SDLK_UP)) m_py += 1*frameTime;
if(L3D::KeyState(SDLK_EQUALS)) m_zoom *= 0.99; if(L3D::KeyState(SDLK_DOWN)) m_py -= 1*frameTime;
if(L3D::KeyState(SDLK_MINUS)) m_zoom *= 1.01; if(L3D::KeyState(SDLK_EQUALS)) m_zoom *= pow(0.5, frameTime);
if(m_zoomInButton->IsPressed()) m_zoom *= 0.99; if(L3D::KeyState(SDLK_MINUS)) m_zoom *= pow(2.0, frameTime);
if(m_zoomOutButton->IsPressed()) m_zoom *= 1.01; if(m_zoomInButton->IsPressed()) m_zoom *= pow(0.5, frameTime);
if(m_zoomOutButton->IsPressed()) m_zoom *= pow(2.0, frameTime);
m_zoom = CLAMP(m_zoom, 0.1, 5.0); m_zoom = CLAMP(m_zoom, 0.1, 5.0);
if(L3D::MouseButtonState(3)) { if(L3D::MouseButtonState(3)) {