aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua/GuiLua.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-10 14:14:08 +1000
committerDavid Walter Seikel2014-05-10 14:14:08 +1000
commit81283b584a7f7c38b697c438858a8b70294dd276 (patch)
treefa8eecfb71c369cbeeda38145403be0ab2e6e4c6 /src/GuiLua/GuiLua.c
parentA note about a useful web site. (diff)
downloadSledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.zip
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.gz
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.bz2
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.xz
Add physics to the windows.
Sure, it's just an annoying gimmick right now, but there's plans for this to be actually useful.
Diffstat (limited to 'src/GuiLua/GuiLua.c')
-rw-r--r--src/GuiLua/GuiLua.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index 55037e0..494be84 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -242,6 +242,7 @@ static int window(lua_State *L)
242{ 242{
243 winFang *win = NULL; 243 winFang *win = NULL;
244 winFang *parent = NULL; 244 winFang *parent = NULL;
245 EPhysics_World *world = NULL;
245 char *name = "GuiLua"; 246 char *name = "GuiLua";
246 char *title = "GuiLua test harness"; 247 char *title = "GuiLua test harness";
247 int w = WIDTH, h = HEIGHT; 248 int w = WIDTH, h = HEIGHT;
@@ -252,9 +253,13 @@ static int window(lua_State *L)
252 lua_getfield(L, LUA_REGISTRYINDEX, glName); 253 lua_getfield(L, LUA_REGISTRYINDEX, glName);
253 gl = lua_touserdata(L, -1); 254 gl = lua_touserdata(L, -1);
254 lua_pop(L, 1); 255 lua_pop(L, 1);
255 if (gl && gl->parent) parent = gl->parent; 256 if (gl)
257 {
258 parent = gl->parent;
259 world = gl->world;
260 }
256 261
257 win = winFangAdd(parent, 25, 25, w, h, title, name); 262 win = winFangAdd(parent, 25, 25, w, h, title, name, world);
258 if (gl) 263 if (gl)
259 { 264 {
260 // If there's no parent, we become the parent. 265 // If there's no parent, we become the parent.
@@ -372,7 +377,7 @@ PD("GuiLua 3");
372 return 1; 377 return 1;
373} 378}
374 379
375GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) 380GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world)
376{ 381{
377 GuiLua *result; 382 GuiLua *result;
378 lua_State *L; 383 lua_State *L;
@@ -380,6 +385,7 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent)
380 385
381 result = calloc(1, sizeof(GuiLua)); 386 result = calloc(1, sizeof(GuiLua));
382 result->parent = parent; 387 result->parent = parent;
388 result->world = world;
383 389
384 L = luaL_newstate(); 390 L = luaL_newstate();
385 if (L) 391 if (L)
@@ -433,12 +439,12 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent)
433 return result; 439 return result;
434} 440}
435 441
436void GuiLuaLoad(char *module, winFang *parent) 442void GuiLuaLoad(char *module, winFang *parent, EPhysics_World *world)
437{ 443{
438 char *args[] = {"GuiLUa", "-l", ""}; 444 char *args[] = {"GuiLUa", "-l", ""};
439 445
440 args[2] = module; 446 args[2] = module;
441 GuiLuaDo(3, args, parent); 447 GuiLuaDo(3, args, parent, world);
442} 448}
443 449
444void GuiLuaDel(GuiLua *gl) 450void GuiLuaDel(GuiLua *gl)