Made mouse cursor not flicker

This commit is contained in:
andreja6
2018-06-02 15:24:32 -07:00
parent 39f68e1acc
commit 0cf7813bea
5 changed files with 16 additions and 0 deletions

View File

@@ -196,11 +196,17 @@ void CameraController::update(Demo* demo)
} }
if(rightButtonHolding) { if(rightButtonHolding) {
Globals::useMousePoint = true;
Globals::mousepoint = oldDesktopMouse;
POINT mouse; POINT mouse;
GetCursorPos(&mouse); GetCursorPos(&mouse);
pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f); pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f);
SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y); SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y);
} }
else
{
Globals::useMousePoint = false;
}
if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) { if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) {
moveRate = 1; moveRate = 1;

View File

@@ -2,6 +2,7 @@
#include <G3DAll.h> #include <G3DAll.h>
#include "Instance.h" #include "Instance.h"
#include "Globals.h"
#include <string> #include <string>
#define CAM_ZOOM_MIN 0.1f #define CAM_ZOOM_MIN 0.1f

View File

@@ -6,6 +6,8 @@ int const Globals::major = 0;
int const Globals::minor = 4; int const Globals::minor = 4;
int const Globals::patch = 2; int const Globals::patch = 2;
bool Globals::showMouse = true; bool Globals::showMouse = true;
bool Globals::useMousePoint = false;
POINT Globals::mousepoint;
Globals::Globals(void){} Globals::Globals(void){}
Globals::~Globals(void){} Globals::~Globals(void){}

View File

@@ -8,6 +8,8 @@ public:
~Globals(void); ~Globals(void);
static DataModelInstance* dataModel; static DataModelInstance* dataModel;
static bool showMouse; static bool showMouse;
static POINT mousepoint;
static bool useMousePoint;
static const int gen; static const int gen;
static const int major; static const int major;
static const int minor; static const int minor;

View File

@@ -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)); LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera()); renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());