Merge default into minor

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-09-27 23:13:01 -03:00
4 changed files with 124 additions and 24 deletions
+13
View File
@@ -30,32 +30,45 @@ LOVE 0.10.2 [Super Toast]
Released: N/A Released: N/A
* Added lovec.exe in Windows. It is the same as love.exe but built with the Console subsystem, so it always uses or provides a console. * Added lovec.exe in Windows. It is the same as love.exe but built with the Console subsystem, so it always uses or provides a console.
* Added the ability to restart the game via love.event.quit("restart").
* Added support for passing a table to love.mouse.isDown, love.keyboard.isDown, love.keyboard.isScancodeDown, Joystick:isDown, and Joystick:isGamepadDown.
* Added 'shaderswitches' field to the table returned by love.graphics.getStats. * Added 'shaderswitches' field to the table returned by love.graphics.getStats.
* Added Quad:getTextureDimensions. * Added Quad:getTextureDimensions.
* Added PrismaticJoint:getAxis and WheelJoint:getAxis. * Added PrismaticJoint:getAxis and WheelJoint:getAxis.
* Added 2-point version of love.physics.newRevoluteJoint. * Added 2-point version of love.physics.newRevoluteJoint.
* Added table variants of Fixture:setCategory and Fixture:setMask. * Added table variants of Fixture:setCategory and Fixture:setMask.
* Added getNextVertex and getPreviousVertex to ChainShape and EdgeShape. * Added getNextVertex and getPreviousVertex to ChainShape and EdgeShape.
* Added optional reference angle arguments to RevoluteJoint, PrismaticJoint, and WeldJoint constructors.
* Added RevoluteJoint:getReferenceAngle, PrismaticJoint:getReferenceAngle, and WeldJoint:getReferenceAngle.
* Deprecated Shader:sendTexture, Shader:sendMatrix, Shader:sendInt, and Shader:sendFloat.
* Fixed love on iOS 6. * Fixed love on iOS 6.
* Fixed os.execute always returning -1 on Linux. * Fixed os.execute always returning -1 on Linux.
* Fixed the love.lowmemory callback to call collectgarbage() after the callback has fired, instead of before.
* Fixed a hang at the end of video playback with some video files. * Fixed a hang at the end of video playback with some video files.
* Fixed the video decoding thread to not do any work when there are no videos to decode. * Fixed the video decoding thread to not do any work when there are no videos to decode.
* Fixed love.graphics.newVideo(file) to no longer error if love.audio is disabled.
* Fixed a rare bug in Source:play for streaming Sources if the associated OpenAL source object was previously used for a static Source. * Fixed a rare bug in Source:play for streaming Sources if the associated OpenAL source object was previously used for a static Source.
* Fixed corrupted Font glyphs in rare cases. * Fixed corrupted Font glyphs in rare cases.
* Fixed stencils inside Canvases on some OpenGL ES 2 devices. * Fixed stencils inside Canvases on some OpenGL ES 2 devices.
* Fixed an OpenGL error in OpenGL ES 3 when multiple render targets are used.
* Fixed love.window.setMode crashing when called with a Canvas active. * Fixed love.window.setMode crashing when called with a Canvas active.
* Fixed gamma correction of ImageFonts and BMFonts with colored images. * Fixed gamma correction of ImageFonts and BMFonts with colored images.
* Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES. * Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES.
* Fixed text coloring breaking because of an empty string. * Fixed text coloring breaking because of an empty string.
* Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem. * Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem.
* Fixed SpriteBatch:setBufferSize to keep old sprite data if it can fit.
* Fixed MouseJoint:getBodies unconditionally erroring. * Fixed MouseJoint:getBodies unconditionally erroring.
* Fixed memory leak in Text:set. * Fixed memory leak in Text:set.
* Fixed incorrect kerning caused by using kerning information for the wrong character in some fonts. * Fixed incorrect kerning caused by using kerning information for the wrong character in some fonts.
* Improved performance of Channel methods by roughly 2x in many cases. * Improved performance of Channel methods by roughly 2x in many cases.
* Improved performance of Shader:send when small numbers of arguments are given.
* Updated love.filesystem.mount to accept a DroppedFile as the first parameter. * Updated love.filesystem.mount to accept a DroppedFile as the first parameter.
* Updated Shader:send to do type and argument checking based on the specified uniform variable's information instead of the arguments to the function.
* Updated Shader:send to accept a flat table for matrix uniforms.
LOVE 0.10.1 [Super Toast] LOVE 0.10.1 [Super Toast]
+54 -13
View File
@@ -105,8 +105,8 @@ int w_Joystick_getAxes(lua_State *L)
Joystick *j = luax_checkjoystick(L, 1); Joystick *j = luax_checkjoystick(L, 1);
std::vector<float> axes = j->getAxes(); std::vector<float> axes = j->getAxes();
for (size_t i = 0; i < axes.size(); i++) for (float value : axes)
lua_pushnumber(L, axes[i]); lua_pushnumber(L, value);
return (int) axes.size(); return (int) axes.size();
} }
@@ -129,11 +129,29 @@ int w_Joystick_isDown(lua_State *L)
{ {
Joystick *j = luax_checkjoystick(L, 1); Joystick *j = luax_checkjoystick(L, 1);
luaL_checkinteger(L, 2); bool istable = lua_istable(L, 2);
int num = istable ? (int) luax_objlen(L, 2) : (lua_gettop(L) - 1);
if (num == 0)
luaL_checkinteger(L, 2);
std::vector<int> buttons; std::vector<int> buttons;
for (int i = 2; i <= lua_gettop(L); i++) buttons.reserve(num);
buttons.push_back((int) luaL_checknumber(L, i) - 1);
if (istable)
{
for (int i = 0; i < num; i++)
{
lua_rawgeti(L, 2, i + 1);
buttons.push_back((int) luaL_checknumber(L, -1) - 1);
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < num; i++)
buttons.push_back((int) luaL_checknumber(L, i + 2) - 1);
}
luax_pushboolean(L, j->isDown(buttons)); luax_pushboolean(L, j->isDown(buttons));
return 1; return 1;
@@ -164,20 +182,43 @@ int w_Joystick_isGamepadDown(lua_State *L)
{ {
Joystick *j = luax_checkjoystick(L, 1); Joystick *j = luax_checkjoystick(L, 1);
bool istable = lua_istable(L, 2);
int num = istable ? (int) luax_objlen(L, 2) : (lua_gettop(L) - 1);
if (num == 0)
luaL_checkstring(L, 2);
std::vector<Joystick::GamepadButton> buttons; std::vector<Joystick::GamepadButton> buttons;
buttons.reserve(lua_gettop(L) - 1); buttons.reserve(num);
luaL_checkstring(L, 2); Joystick::GamepadButton button;
for (int i = 2; i <= lua_gettop(L); i++) if (istable)
{ {
const char *str = luaL_checkstring(L, i); for (int i = 0; i < num; i++)
Joystick::GamepadButton button; {
lua_rawgeti(L, 2, i + 1);
const char *str = luaL_checkstring(L, -1);
if (!joystick::Joystick::getConstant(str, button)) if (!joystick::Joystick::getConstant(str, button))
return luaL_error(L, "Invalid gamepad button: %s", str); return luaL_error(L, "Invalid gamepad button: %s", str);
buttons.push_back(button); buttons.push_back(button);
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < num; i++)
{
const char *str = luaL_checkstring(L, i + 2);
if (!joystick::Joystick::getConstant(str, button))
return luaL_error(L, "Invalid gamepad button: %s", str);
buttons.push_back(button);
}
} }
luax_pushboolean(L, j->isGamepadDown(buttons)); luax_pushboolean(L, j->isGamepadDown(buttons));
+40 -8
View File
@@ -46,14 +46,30 @@ int w_hasKeyRepeat(lua_State *L)
int w_isDown(lua_State *L) int w_isDown(lua_State *L)
{ {
Keyboard::Key k; Keyboard::Key k;
int num = lua_gettop(L);
bool istable = lua_istable(L, 1);
int num = istable ? (int) luax_objlen(L, 1) : lua_gettop(L);
std::vector<Keyboard::Key> keylist; std::vector<Keyboard::Key> keylist;
keylist.reserve(num); keylist.reserve(num);
for (int i = 0; i < num; i++) if (istable)
{ {
if (Keyboard::getConstant(luaL_checkstring(L, i+1), k)) for (int i = 0; i < num; i++)
keylist.push_back(k); {
lua_rawgeti(L, 1, i + 1);
if (Keyboard::getConstant(luaL_checkstring(L, -1), k))
keylist.push_back(k);
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < num; i++)
{
if (Keyboard::getConstant(luaL_checkstring(L, i+1), k))
keylist.push_back(k);
}
} }
luax_pushboolean(L, instance()->isDown(keylist)); luax_pushboolean(L, instance()->isDown(keylist));
@@ -63,14 +79,30 @@ int w_isDown(lua_State *L)
int w_isScancodeDown(lua_State *L) int w_isScancodeDown(lua_State *L)
{ {
Keyboard::Scancode scancode; Keyboard::Scancode scancode;
int num = lua_gettop(L);
bool istable = lua_istable(L, 1);
int num = istable ? (int) luax_objlen(L, 1) : lua_gettop(L);
std::vector<Keyboard::Scancode> scancodelist; std::vector<Keyboard::Scancode> scancodelist;
scancodelist.reserve(num); scancodelist.reserve(num);
for (int i = 0; i < num; i++) if (istable)
{ {
if (Keyboard::getConstant(luaL_checkstring(L, i+1), scancode)) for (int i = 0; i < num; i++)
scancodelist.push_back(scancode); {
lua_rawgeti(L, 1, i + 1);
if (Keyboard::getConstant(luaL_checkstring(L, -1), scancode))
scancodelist.push_back(scancode);
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < num; i++)
{
if (Keyboard::getConstant(luaL_checkstring(L, i+1), scancode))
scancodelist.push_back(scancode);
}
} }
luax_pushboolean(L, instance()->isScancodeDown(scancodelist)); luax_pushboolean(L, instance()->isScancodeDown(scancodelist));
+17 -3
View File
@@ -142,12 +142,26 @@ int w_setPosition(lua_State *L)
int w_isDown(lua_State *L) int w_isDown(lua_State *L)
{ {
int num = lua_gettop(L); bool istable = lua_istable(L, 1);
int num = istable ? (int) luax_objlen(L, 1) : lua_gettop(L);
std::vector<int> buttons; std::vector<int> buttons;
buttons.reserve(num); buttons.reserve(num);
for (int i = 0; i < num; i++) if (istable)
buttons.push_back((int) luaL_checknumber(L, i + 1)); {
for (int i = 0; i < num; i++)
{
lua_rawgeti(L, 1, i + 1);
buttons.push_back((int) luaL_checknumber(L, -1));
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < num; i++)
buttons.push_back((int) luaL_checknumber(L, i + 1));
}
luax_pushboolean(L, instance()->isDown(buttons)); luax_pushboolean(L, instance()->isDown(buttons));
return 1; return 1;