Made camera only move when application has focus
This commit is contained in:
@@ -59,6 +59,7 @@ class Application { // : public GApp {
|
|||||||
Tool * tool;
|
Tool * tool;
|
||||||
void changeTool(Tool *);
|
void changeTool(Tool *);
|
||||||
Mouse mouse;
|
Mouse mouse;
|
||||||
|
bool viewportHasFocus();
|
||||||
private:
|
private:
|
||||||
bool mouseMoveState;
|
bool mouseMoveState;
|
||||||
RenderDevice* renderDevice;
|
RenderDevice* renderDevice;
|
||||||
|
|||||||
@@ -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)
|
void Application::navigateToolbox(std::string path)
|
||||||
{
|
{
|
||||||
int len = path.size() + 1;
|
int len = path.size() + 1;
|
||||||
|
|||||||
@@ -193,6 +193,8 @@ void CameraController::update(Application* app)
|
|||||||
Vector3 cameraPos = g3dCamera.getCoordinateFrame().translation;
|
Vector3 cameraPos = g3dCamera.getCoordinateFrame().translation;
|
||||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||||
bool moving=false;
|
bool moving=false;
|
||||||
|
if(!app->viewportHasFocus())
|
||||||
|
return;
|
||||||
if(GetHoldKeyState('U')) {
|
if(GetHoldKeyState('U')) {
|
||||||
forwards = true;
|
forwards = true;
|
||||||
moving=true;
|
moving=true;
|
||||||
|
|||||||
Reference in New Issue
Block a user