mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-13 01:51:10 +00:00
Make mouse constraint circle scriptable. New Lua functions:
- setMouseConstraintCircle() - setMouseConstraint()
This commit is contained in:
parent
071ca187e6
commit
af463e63b2
4 changed files with 21 additions and 4 deletions
|
@ -3296,10 +3296,12 @@ void Core::setMouseConstraint(bool on)
|
|||
mouseConstraint = on;
|
||||
}
|
||||
|
||||
void Core::setMouseConstraintCircle(float circle)
|
||||
void Core::setMouseConstraintCircle(const Vector& pos, float circle)
|
||||
{
|
||||
mouseConstraint = true;
|
||||
mouseCircle = circle;
|
||||
mouseConstraintCenter = pos;
|
||||
mouseConstraintCenter.z = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3333,7 +3335,7 @@ bool Core::doMouseConstraint()
|
|||
{
|
||||
//- core->getVirtualOffX()
|
||||
//- virtualOffX
|
||||
Vector h = Vector(core->center.x , core->center.y);
|
||||
Vector h = mouseConstraintCenter;
|
||||
Vector d = mouse.position - h;
|
||||
if (!d.isLength2DIn(mouseCircle))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue