comparison src/modules/graphics/opengl/Graphics.cpp @ 1418:357697c2e2a8

More internal code cleanup
author Alex Szpakowski <slime73@gmail.com>
date Sun, 31 Mar 2013 19:02:27 -0300
parents 2b1dbb6e49bf
children 2a5ef265e040 86757de71c7c
comparison
equal deleted inserted replaced
1417:c70c9e4d10f3 1418:357697c2e2a8
270 } 270 }
271 271
272 int Graphics::getModes(lua_State *L) const 272 int Graphics::getModes(lua_State *L) const
273 { 273 {
274 int n; 274 int n;
275 love::window::Window::WindowSize **modes = currentWindow->getFullscreenSizes(n); 275 love::window::Window::WindowSize *modes = currentWindow->getFullscreenSizes(n);
276 276
277 if (modes == 0) 277 if (modes == 0)
278 return 0; 278 return 0;
279 279
280 lua_newtable(L); 280 lua_createtable(L, n, 0);
281 281
282 for (int i = 0; i < n ; i++) 282 for (int i = 0; i < n ; i++)
283 { 283 {
284 lua_pushinteger(L, i+1); 284 lua_pushinteger(L, i+1);
285 lua_newtable(L); 285 lua_createtable(L, 0, 2);
286 286
287 // Inner table attribs. 287 // Inner table attribs.
288 288
289 lua_pushstring(L, "width"); 289 lua_pushinteger(L, modes[i].width);
290 lua_pushinteger(L, modes[i]->width); 290 lua_setfield(L, -2, "width");
291
292 lua_pushinteger(L, modes[i].height);
293 lua_setfield(L, -2, "height");
294
295 // Inner table attribs end.
296
291 lua_settable(L, -3); 297 lua_settable(L, -3);
292
293 lua_pushstring(L, "height");
294 lua_pushinteger(L, modes[i]->height);
295 lua_settable(L, -3);
296
297 // Inner table attribs end.
298
299 lua_settable(L, -3);
300
301 delete modes[i];
302 } 298 }
303 299
304 delete[] modes; 300 delete[] modes;
305 return 1; 301 return 1;
306 } 302 }