mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +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()
|
||||
{
|
||||
// Try to do the change.
|
||||
return setMode(currentMode.width,
|
||||
if(!setMode(currentMode.width,
|
||||
currentMode.height,
|
||||
!currentMode.fullscreen,
|
||||
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
|
||||
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
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
if (table) {
|
||||
lua_pushnil(L);
|
||||
while (true) {
|
||||
if(lua_next(L, 1) == 0) break;
|
||||
GLfloat x = (GLfloat)lua_tonumber(L, -1);
|
||||
lua_pop(L, 1); // pop value
|
||||
if(lua_next(L, 1) == 0) break;
|
||||
GLfloat y = (GLfloat)lua_tonumber(L, -1);
|
||||
lua_pop(L, 1); // pop value
|
||||
glVertex2f(x, y);
|
||||
for (int i = 1; i < args; i += 2) {
|
||||
lua_pushnumber(L, i); // x coordinate
|
||||
lua_rawget(L, 1);
|
||||
lua_pushnumber(L, i+1); // y coordinate
|
||||
lua_rawget(L, 1);
|
||||
glVertex2f((GLfloat)lua_tonumber(L, -2), (GLfloat)lua_tonumber(L, -1));
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
} else {
|
||||
for (int i = 1; i < args; i+=2) {
|
||||
|
||||
Reference in New Issue
Block a user