Hi after a couple of hours researching here it is:
header file
#pragma once
class MouseHandler
{
private:
double mouseZ;
double mousePrevX;
double mousePrevY;
double mousePrevZ;
int mouseClick;
int mousePrevClick;
public:
double mouseX;
double mouseY;
MouseHandler();
static void updateMouse( void*);
void update(int,int,int,int);
double getMouseX();
double getMouseY();
double getMouseZ();
int getMouseClick();
double getMouseMoveX();
double getMouseMoveY();
double getMouseMoveZ();
};
CPP File
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include "DarkGDK.h"
#include "windows.h"
#include "MouseHandler.h"
MouseHandler::MouseHandler()
{
this->mouseX = 0;
this->mouseY = 0;
this->mouseZ = 0;
this->mousePrevX = 0;
this->mousePrevY = 0;
this->mousePrevZ = 0;
this->mouseClick = 0;
this->mousePrevClick = 0;
_beginthread(&MouseHandler::updateMouse,0,this);
}
void MouseHandler::updateMouse( void* dummy)
{
MouseHandler *instance= reinterpret_cast<MouseHandler *>(dummy);
do
{
instance->mousePrevX = instance->mouseX;
instance->mousePrevY = instance->mouseY;
instance->mousePrevZ = instance->mouseZ;
instance->mousePrevClick = instance->mouseClick;
instance->mouseX = dbMouseX();
instance->mouseY = dbMouseY();
instance->mouseZ = dbMouseZ();
instance->mouseClick = dbMouseClick();
Sleep(30);
}
while(true);
}
double MouseHandler::getMouseX()
{
return this->mouseX;
}
double MouseHandler::getMouseY()
{
return this->mouseY;
}
double MouseHandler::getMouseZ()
{
return this->mouseZ;
}
int MouseHandler::getMouseClick()
{
return this->mouseClick;
}
double MouseHandler::getMouseMoveX()
{
return this->mouseX - this->mousePrevX;
}
double MouseHandler::getMouseMoveY()
{
return this->mouseY - this->mousePrevY;
}
double MouseHandler::getMouseMoveZ()
{
return this->mouseZ - this->mousePrevZ;
}