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) {
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;

View File

@@ -2,6 +2,7 @@
#include <G3DAll.h>
#include "Instance.h"
#include "Globals.h"
#include <string>
#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::patch = 2;
bool Globals::showMouse = true;
bool Globals::useMousePoint = false;
POINT Globals::mousepoint;
Globals::Globals(void){}
Globals::~Globals(void){}

View File

@@ -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;

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));
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());