Merge remote-tracking branch 'origin/Input' into New-inputsystem
Conflicts: Code/Misc/Input/Include/Mouse.h
This commit is contained in:
commit
536f1a69da
|
@ -68,12 +68,14 @@ namespace Input
|
|||
public:
|
||||
virtual ~Mouse();
|
||||
|
||||
virtual bool IsBtnUp(Enum::SAMI key) = 0;
|
||||
virtual bool IsBtnDown(Enum::SAMI key) = 0;
|
||||
virtual int GetWheelDelta() = 0;
|
||||
virtual Struct::SAIPoint2D GetPixelPosition(Struct::SAIPoint2D targetMem = Struct::SAIPoint2D()) = 0;
|
||||
|
||||
virtual bool IsBtnUp(Enum::SAMI key) = 0;
|
||||
virtual bool IsBtnDown(Enum::SAMI key) = 0;
|
||||
|
||||
public:
|
||||
int GetWheelDelta() const;
|
||||
Struct::SAIPoint2D & GetPixelPosition( Struct::SAIPoint2D &targetMem = Struct::SAIPoint2D() ) const;
|
||||
Struct::SAIPoint2D & GetDeltaPosition( Struct::SAIPoint2D &targetMem = Struct::SAIPoint2D() ) const;
|
||||
|
||||
void AddOnMousePressCallback( Typedefs::OnMousePressCallback func);
|
||||
void AddOnMouseDownCallback( Typedefs::OnMouseDownCallback func );
|
||||
void AddOnMouseReleaseCallback( Typedefs::OnMouseReleaseCallback func );
|
||||
|
@ -136,7 +138,7 @@ namespace Input
|
|||
protected:
|
||||
std::vector<MouseEvent*> mouseSubscribers;
|
||||
MouseCallbackList* callbackList;
|
||||
Struct::SAIPoint2D pixelPos;
|
||||
Struct::SAIPoint2D pixelPos, deltaPos;
|
||||
bool isCurorLocked;
|
||||
int wheelDelta;
|
||||
};
|
||||
|
|
|
@ -17,8 +17,6 @@ namespace Input
|
|||
|
||||
bool IsBtnUp(Enum::SAMI key) override;
|
||||
bool IsBtnDown(Enum::SAMI key) override;
|
||||
int GetWheelDelta() override;
|
||||
Struct::SAIPoint2D GetPixelPosition(Struct::SAIPoint2D targetMem = Struct::SAIPoint2D()) override;
|
||||
|
||||
void ProccessMouseData (bool isDown, Enum::SAMI btn, int delta, Struct::SAIPoint2D velocity, unsigned int makeCode);
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ Mouse::Mouse()
|
|||
, wheelDelta(0)
|
||||
, isCurorLocked(0)
|
||||
, pixelPos()
|
||||
, deltaPos()
|
||||
{
|
||||
}
|
||||
Mouse::~Mouse()
|
||||
|
@ -88,6 +89,25 @@ Mouse::~Mouse()
|
|||
|
||||
}
|
||||
|
||||
int Mouse::GetWheelDelta() const
|
||||
{
|
||||
return this->wheelDelta;
|
||||
}
|
||||
|
||||
SAIPoint2D & Mouse::GetPixelPosition( Struct::SAIPoint2D &targetMem ) const
|
||||
{
|
||||
targetMem.x = this->pixelPos.x;
|
||||
targetMem.y = this->pixelPos.y;
|
||||
return targetMem;
|
||||
}
|
||||
|
||||
SAIPoint2D & Mouse::GetDeltaPosition( Struct::SAIPoint2D &targetMem ) const
|
||||
{
|
||||
targetMem.x = this->deltaPos.x;
|
||||
targetMem.y = this->deltaPos.y;
|
||||
return targetMem;
|
||||
}
|
||||
|
||||
void Mouse::AddOnMousePressCallback( Typedefs::OnMousePressCallback func)
|
||||
{
|
||||
MouseCallbackList::CallbackData d;
|
||||
|
|
|
@ -30,22 +30,13 @@ bool Win32Mouse::IsBtnDown(Enum::SAMI btn)
|
|||
|
||||
return this->buttons[btn].isDown;
|
||||
}
|
||||
int Win32Mouse::GetWheelDelta()
|
||||
{
|
||||
return this->wheelDelta;
|
||||
}
|
||||
Struct::SAIPoint2D Win32Mouse::GetPixelPosition(Struct::SAIPoint2D targetMem)
|
||||
{
|
||||
targetMem = this->pixelPos;
|
||||
return targetMem;
|
||||
}
|
||||
|
||||
void Win32Mouse::ProccessMouseData (bool isUp, Enum::SAMI btn, int delta, Struct::SAIPoint2D velocity, unsigned int makeCode)
|
||||
{
|
||||
if(velocity.Length() != 0)
|
||||
{
|
||||
this->pixelPos.x += velocity.x;
|
||||
this->pixelPos.y += velocity.y;
|
||||
this->pixelPos.x += this->deltaPos.x = velocity.x;
|
||||
this->pixelPos.y += this->deltaPos.y = velocity.y;
|
||||
|
||||
for (unsigned int i = 0; i < this->mouseSubscribers.size(); i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue