Made camera only move when application has focus

This commit is contained in:
Vulpovile
2022-10-03 19:43:35 -07:00
parent f46e24d8f1
commit 33a898e359
3 changed files with 8 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ class Application { // : public GApp {
Tool * tool;
void changeTool(Tool *);
Mouse mouse;
bool viewportHasFocus();
private:
bool mouseMoveState;
RenderDevice* renderDevice;

View File

@@ -143,6 +143,11 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
}
bool Application::viewportHasFocus()
{
return GetActiveWindow() == this->_hWndMain;
}
void Application::navigateToolbox(std::string path)
{
int len = path.size() + 1;

View File

@@ -193,6 +193,8 @@ void CameraController::update(Application* app)
Vector3 cameraPos = g3dCamera.getCoordinateFrame().translation;
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
bool moving=false;
if(!app->viewportHasFocus())
return;
if(GetHoldKeyState('U')) {
forwards = true;
moving=true;