[Fix] Fixed broken system info view.

[Fix] Fixed mouse screw up in system view.
This commit is contained in:
Allanis 2017-11-13 22:30:54 +00:00
parent 5bd34e49c4
commit 55254b20db
3 changed files with 13 additions and 5 deletions

View File

@ -171,7 +171,9 @@ void L3D::HandleEvents(void) {
event.button.x, event.button.y);
break;
case SDL_MOUSEMOTION:
SDL_GetRelativeMouseState(&L3D::mouseMotion[0], &L3D::mouseMotion[1]);
L3D::mouseMotion[0] += event.motion.xrel;
L3D::mouseMotion[1] += event.motion.yrel;
//SDL_GetRelativeMouseState(&L3D::mouseMotion[0], &L3D::mouseMotion[1]);
break;
case SDL_QUIT:
L3D::Quit();

View File

@ -94,6 +94,11 @@ void SystemInfoView::SystemChanged(StarSystem* s) {
}
void SystemInfoView::Draw3D(void) {
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GenericSystemView::Draw3D();
}

View File

@ -197,15 +197,16 @@ void SystemView::Draw3D(void) {
}
void SystemView::Update(void) {
const float ft = L3D::GetFrameTime();
if(L3D::KeyState(SDLK_EQUALS) ||
m_zoomInButton->IsPressed()) m_zoom *= 1.01;
m_zoomInButton->IsPressed()) m_zoom *= pow(4, ft);
if(L3D::KeyState(SDLK_MINUS) ||
m_zoomOutButton->IsPressed()) m_zoom *= 0.99;
m_zoomOutButton->IsPressed()) m_zoom *= pow(0.25, ft);
if(L3D::MouseButtonState(3)) {
int motion[2];
L3D::GetMouseMotion(motion);
m_rot_x += motion[1]/4.0;
m_rot_z += motion[0]/4.0;
m_rot_x += motion[1]*20*ft;
m_rot_z += motion[0]*20*ft;
}
}