mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Fix issue #176: unexpected behaivior of love.graphics.line with hash-table argument.
This commit is contained in:
@@ -299,11 +299,14 @@ namespace opengl
|
|||||||
bool Graphics::toggleFullscreen()
|
bool Graphics::toggleFullscreen()
|
||||||
{
|
{
|
||||||
// Try to do the change.
|
// Try to do the change.
|
||||||
return setMode(currentMode.width,
|
if(!setMode(currentMode.width,
|
||||||
currentMode.height,
|
currentMode.height,
|
||||||
!currentMode.fullscreen,
|
!currentMode.fullscreen,
|
||||||
currentMode.vsync,
|
currentMode.vsync,
|
||||||
currentMode.fsaa);
|
currentMode.fsaa))
|
||||||
|
return false;
|
||||||
|
currentMode.fullscreen = !currentMode.fullscreen;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -826,20 +829,20 @@ namespace opengl
|
|||||||
|
|
||||||
if (args % 2) // an odd number of arguments, no good for a polyline
|
if (args % 2) // an odd number of arguments, no good for a polyline
|
||||||
return luaL_error(L, "Number of vertices must be a multiple of two");
|
return luaL_error(L, "Number of vertices must be a multiple of two");
|
||||||
|
else if (args < 4)
|
||||||
|
return luaL_error(L, "Need at least two vertices to draw a line");
|
||||||
|
|
||||||
// right, let's draw this polyline, then
|
// right, let's draw this polyline, then
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
if (table) {
|
if (table) {
|
||||||
lua_pushnil(L);
|
for (int i = 1; i < args; i += 2) {
|
||||||
while (true) {
|
lua_pushnumber(L, i); // x coordinate
|
||||||
if(lua_next(L, 1) == 0) break;
|
lua_rawget(L, 1);
|
||||||
GLfloat x = (GLfloat)lua_tonumber(L, -1);
|
lua_pushnumber(L, i+1); // y coordinate
|
||||||
lua_pop(L, 1); // pop value
|
lua_rawget(L, 1);
|
||||||
if(lua_next(L, 1) == 0) break;
|
glVertex2f((GLfloat)lua_tonumber(L, -2), (GLfloat)lua_tonumber(L, -1));
|
||||||
GLfloat y = (GLfloat)lua_tonumber(L, -1);
|
lua_pop(L, 2);
|
||||||
lua_pop(L, 1); // pop value
|
|
||||||
glVertex2f(x, y);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 1; i < args; i+=2) {
|
for (int i = 1; i < args; i+=2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user