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