mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 04:31:26 +02:00
updated to latest mobile-common (0cf55b7da58e), removed libtiff, libpng, libmng, devil, jasper, jpeg-8d, added libturbo-jpeg
This commit is contained in:
@@ -115,6 +115,12 @@ public:
|
||||
**/
|
||||
BezierCurve *newBezierCurve(const std::vector<Vector> &points);
|
||||
|
||||
// Implements Module.
|
||||
virtual ModuleType getModuleType() const
|
||||
{
|
||||
return M_MATH;
|
||||
}
|
||||
|
||||
virtual const char *getName() const
|
||||
{
|
||||
return "love.math";
|
||||
|
||||
@@ -45,6 +45,7 @@ int w_BezierCurve_getDerivative(lua_State *L)
|
||||
BezierCurve *curve = luax_checkbeziercurve(L, 1);
|
||||
BezierCurve *deriv = new BezierCurve(curve->getDerivative());
|
||||
luax_pushtype(L, "BezierCurve", MATH_BEZIER_CURVE_T, deriv);
|
||||
deriv->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -56,11 +57,11 @@ int w_BezierCurve_getControlPoint(lua_State *L)
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
EXCEPT_GUARD(
|
||||
luax_catchexcept(L, [&]() {
|
||||
Vector v = curve->getControlPoint(idx);
|
||||
lua_pushnumber(L, v.x);
|
||||
lua_pushnumber(L, v.y);
|
||||
)
|
||||
});
|
||||
|
||||
return 2;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ int w_BezierCurve_setControlPoint(lua_State *L)
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
EXCEPT_GUARD(curve->setControlPoint(idx, Vector(vx,vy));)
|
||||
luax_catchexcept(L, [&](){ curve->setControlPoint(idx, Vector(vx,vy)); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ int w_BezierCurve_insertControlPoint(lua_State *L)
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
EXCEPT_GUARD(curve->insertControlPoint(Vector(vx,vy), idx);)
|
||||
luax_catchexcept(L, [&](){ curve->insertControlPoint(Vector(vx,vy), idx); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -134,11 +135,11 @@ int w_BezierCurve_evaluate(lua_State *L)
|
||||
BezierCurve *curve = luax_checkbeziercurve(L, 1);
|
||||
double t = luaL_checknumber(L, 2);
|
||||
|
||||
EXCEPT_GUARD(
|
||||
luax_catchexcept(L, [&]() {
|
||||
Vector v = curve->evaluate(t);
|
||||
lua_pushnumber(L, v.x);
|
||||
lua_pushnumber(L, v.y);
|
||||
)
|
||||
});
|
||||
|
||||
return 2;
|
||||
|
||||
@@ -150,7 +151,7 @@ int w_BezierCurve_render(lua_State *L)
|
||||
int accuracy = luaL_optinteger(L, 2, 5);
|
||||
|
||||
std::vector<Vector> points;
|
||||
EXCEPT_GUARD(points = curve->render(accuracy);)
|
||||
luax_catchexcept(L, [&](){ points = curve->render(accuracy); });
|
||||
|
||||
lua_createtable(L, points.size()*2, 0);
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
|
||||
@@ -49,7 +49,7 @@ int w_randomNormal(lua_State *L)
|
||||
|
||||
int w_setRandomSeed(lua_State *L)
|
||||
{
|
||||
EXCEPT_GUARD(Math::instance.setRandomSeed(luax_checkrandomseed(L, 1));)
|
||||
luax_catchexcept(L, [&](){ Math::instance.setRandomSeed(luax_checkrandomseed(L, 1)); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ int w_getRandomSeed(lua_State *L)
|
||||
|
||||
int w_setRandomState(lua_State *L)
|
||||
{
|
||||
EXCEPT_GUARD(Math::instance.setRandomState(luax_checkstring(L, 1));)
|
||||
luax_catchexcept(L, [&](){ Math::instance.setRandomState(luax_checkstring(L, 1)); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ int w_newRandomGenerator(lua_State *L)
|
||||
}
|
||||
|
||||
luax_pushtype(L, "RandomGenerator", MATH_RANDOM_GENERATOR_T, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -139,6 +140,7 @@ int w_newBezierCurve(lua_State *L)
|
||||
|
||||
BezierCurve *curve = Math::instance.newBezierCurve(points);
|
||||
luax_pushtype(L, "BezierCurve", MATH_BEZIER_CURVE_T, curve);
|
||||
curve->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -180,12 +182,12 @@ int w_triangulate(lua_State *L)
|
||||
|
||||
std::vector<Triangle> triangles;
|
||||
|
||||
EXCEPT_GUARD(
|
||||
luax_catchexcept(L, [&]() {
|
||||
if (vertices.size() == 3)
|
||||
triangles.push_back(Triangle(vertices[0], vertices[1], vertices[2]));
|
||||
else
|
||||
triangles = Math::instance.triangulate(vertices);
|
||||
)
|
||||
});
|
||||
|
||||
lua_createtable(L, triangles.size(), 0);
|
||||
for (size_t i = 0; i < triangles.size(); ++i)
|
||||
|
||||
@@ -108,7 +108,7 @@ int w_RandomGenerator_randomNormal(lua_State *L)
|
||||
int w_RandomGenerator_setSeed(lua_State *L)
|
||||
{
|
||||
RandomGenerator *rng = luax_checkrandomgenerator(L, 1);
|
||||
EXCEPT_GUARD(rng->setSeed(luax_checkrandomseed(L, 2));)
|
||||
luax_catchexcept(L, [&](){ rng->setSeed(luax_checkrandomseed(L, 2)); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ int w_RandomGenerator_getSeed(lua_State *L)
|
||||
int w_RandomGenerator_setState(lua_State *L)
|
||||
{
|
||||
RandomGenerator *rng = luax_checkrandomgenerator(L, 1);
|
||||
EXCEPT_GUARD(rng->setState(luax_checkstring(L, 2));)
|
||||
luax_catchexcept(L, [&](){ rng->setState(luax_checkstring(L, 2)); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user