Made mouse cursor not flicker
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <G3DAll.h>
|
||||
#include "Instance.h"
|
||||
#include "Globals.h"
|
||||
#include <string>
|
||||
|
||||
#define CAM_ZOOM_MIN 0.1f
|
||||
|
||||
@@ -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){}
|
||||
|
||||
@@ -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;
|
||||
|
||||
5
main.cpp
5
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());
|
||||
|
||||
Reference in New Issue
Block a user