diff --git a/CameraController.cpp b/CameraController.cpp index a7c78bf..567f089 100644 --- a/CameraController.cpp +++ b/CameraController.cpp @@ -196,11 +196,17 @@ void CameraController::update(Demo* demo) } if(rightButtonHolding) { + Globals::useMousePoint = true; + Globals::mousepoint = oldDesktopMouse; POINT mouse; GetCursorPos(&mouse); pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f); SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y); } + else + { + Globals::useMousePoint = false; + } if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) { moveRate = 1; diff --git a/CameraController.h b/CameraController.h index 8fd23a3..c6c6ccb 100644 --- a/CameraController.h +++ b/CameraController.h @@ -2,6 +2,7 @@ #include #include "Instance.h" +#include "Globals.h" #include #define CAM_ZOOM_MIN 0.1f diff --git a/Globals.cpp b/Globals.cpp index 365a13e..13d4520 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -6,6 +6,8 @@ int const Globals::major = 0; int const Globals::minor = 4; int const Globals::patch = 2; bool Globals::showMouse = true; +bool Globals::useMousePoint = false; +POINT Globals::mousepoint; Globals::Globals(void){} Globals::~Globals(void){} diff --git a/Globals.h b/Globals.h index 40175b4..db0e4b5 100644 --- a/Globals.h +++ b/Globals.h @@ -8,6 +8,8 @@ public: ~Globals(void); static DataModelInstance* dataModel; static bool showMouse; + static POINT mousepoint; + static bool useMousePoint; static const int gen; static const int major; static const int minor; diff --git a/main.cpp b/main.cpp index e28cc77..8ef7617 100644 --- a/main.cpp +++ b/main.cpp @@ -999,6 +999,11 @@ void Demo::onGraphics(RenderDevice* rd) { } } + if(Globals::useMousePoint) + { + mousepos = Globals::mousepoint; + ScreenToClient(hWndMain, &mousepos); + } LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM)); renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());