Simplify Drawable code

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-18 22:06:52 -03:00
parent a844c16657
commit b8b670e0ae
23 changed files with 93 additions and 159 deletions
+10 -8
View File
@@ -1551,11 +1551,13 @@ int w_draw(lua_State *L)
float kx = (float) luaL_optnumber(L, startidx + 7, 0.0);
float ky = (float) luaL_optnumber(L, startidx + 8, 0.0);
Matrix4 m(x, y, a, sx, sy, ox, oy, kx, ky);
luax_catchexcept(L, [&]() {
if (texture && quad)
texture->drawq(quad, x, y, a, sx, sy, ox, oy, kx, ky);
texture->drawq(quad, m);
else if (drawable)
drawable->draw(x, y, a, sx, sy, ox, oy, kx, ky);
drawable->draw(m);
});
return 0;
@@ -1576,9 +1578,9 @@ int w_print(lua_State *L)
float kx = (float)luaL_optnumber(L, 9, 0.0f);
float ky = (float)luaL_optnumber(L, 10, 0.0f);
luax_catchexcept(L,
[&](){ instance()->print(str, x, y, angle, sx, sy, ox, oy, kx,ky); }
);
Matrix4 m(x, y, angle, sx, sy, ox, oy, kx, ky);
luax_catchexcept(L, [&](){ instance()->print(str, m); });
return 0;
}
@@ -1616,9 +1618,9 @@ int w_printf(lua_State *L)
ky = (float) luaL_optnumber(L, 12, 0.0f);
}
luax_catchexcept(L,
[&](){ instance()->printf(str, x, y, wrap, align, angle, sx, sy, ox, oy, kx, ky); }
);
Matrix4 m(x, y, angle, sx, sy, ox, oy, kx, ky);
luax_catchexcept(L, [&](){ instance()->printf(str, wrap, align, m); });
return 0;
}