mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09:06 +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
|
@ -1426,7 +1426,7 @@ void Avatar::openSingingInterface()
|
||||||
//core->setMousePosition(Vector(400,300));
|
//core->setMousePosition(Vector(400,300));
|
||||||
}
|
}
|
||||||
|
|
||||||
core->setMouseConstraintCircle(singingInterfaceRadius);
|
core->setMouseConstraintCircle(core->center, singingInterfaceRadius);
|
||||||
stopRoll();
|
stopRoll();
|
||||||
singing = true;
|
singing = true;
|
||||||
currentSongIdx = SONG_NONE;
|
currentSongIdx = SONG_NONE;
|
||||||
|
|
|
@ -8060,6 +8060,18 @@ luaFunc(getMouseWheelChange)
|
||||||
luaReturnNum(core->mouse.scrollWheelChange);
|
luaReturnNum(core->mouse.scrollWheelChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(setMouseConstraintCircle)
|
||||||
|
{
|
||||||
|
core->setMouseConstraintCircle(Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)), lua_tonumber(L, 3));
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(setMouseConstraint)
|
||||||
|
{
|
||||||
|
core->setMouseConstraint(getBool(L, 1));
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(fade)
|
luaFunc(fade)
|
||||||
{
|
{
|
||||||
dsq->overlay->color.interpolateTo(Vector(lua_tonumber(L, 3), lua_tonumber(L, 4), lua_tonumber(L, 5)), lua_tonumber(L, 6));
|
dsq->overlay->color.interpolateTo(Vector(lua_tonumber(L, 3), lua_tonumber(L, 4), lua_tonumber(L, 5)), lua_tonumber(L, 6));
|
||||||
|
@ -9114,6 +9126,8 @@ static const struct {
|
||||||
luaRegister(getMousePos),
|
luaRegister(getMousePos),
|
||||||
luaRegister(getMouseWorldPos),
|
luaRegister(getMouseWorldPos),
|
||||||
luaRegister(getMouseWheelChange),
|
luaRegister(getMouseWheelChange),
|
||||||
|
luaRegister(setMouseConstraintCircle),
|
||||||
|
luaRegister(setMouseConstraint),
|
||||||
|
|
||||||
luaRegister(resetContinuity),
|
luaRegister(resetContinuity),
|
||||||
|
|
||||||
|
|
|
@ -3296,10 +3296,12 @@ void Core::setMouseConstraint(bool on)
|
||||||
mouseConstraint = on;
|
mouseConstraint = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::setMouseConstraintCircle(float circle)
|
void Core::setMouseConstraintCircle(const Vector& pos, float circle)
|
||||||
{
|
{
|
||||||
mouseConstraint = true;
|
mouseConstraint = true;
|
||||||
mouseCircle = circle;
|
mouseCircle = circle;
|
||||||
|
mouseConstraintCenter = pos;
|
||||||
|
mouseConstraintCenter.z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3333,7 +3335,7 @@ bool Core::doMouseConstraint()
|
||||||
{
|
{
|
||||||
//- core->getVirtualOffX()
|
//- core->getVirtualOffX()
|
||||||
//- virtualOffX
|
//- virtualOffX
|
||||||
Vector h = Vector(core->center.x , core->center.y);
|
Vector h = mouseConstraintCenter;
|
||||||
Vector d = mouse.position - h;
|
Vector d = mouse.position - h;
|
||||||
if (!d.isLength2DIn(mouseCircle))
|
if (!d.isLength2DIn(mouseCircle))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ public:
|
||||||
void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT);
|
void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT);
|
||||||
|
|
||||||
void setMouseConstraint(bool on);
|
void setMouseConstraint(bool on);
|
||||||
void setMouseConstraintCircle(float mouseCircle);
|
void setMouseConstraintCircle(const Vector& pos, float mouseCircle);
|
||||||
|
|
||||||
void setReentryInputGrab(int on);
|
void setReentryInputGrab(int on);
|
||||||
|
|
||||||
|
@ -1350,6 +1350,7 @@ protected:
|
||||||
std::string appName;
|
std::string appName;
|
||||||
bool mouseConstraint;
|
bool mouseConstraint;
|
||||||
float mouseCircle;
|
float mouseCircle;
|
||||||
|
Vector mouseConstraintCenter;
|
||||||
|
|
||||||
bool doMouseConstraint();
|
bool doMouseConstraint();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue