aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua
diff options
context:
space:
mode:
Diffstat (limited to 'src/GuiLua')
-rw-r--r--src/GuiLua/GuiLua.c16
-rw-r--r--src/GuiLua/GuiLua.h5
-rw-r--r--src/GuiLua/skang.c2
3 files changed, 15 insertions, 8 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)
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h
index b123fe7..3bd2baf 100644
--- a/src/GuiLua/GuiLua.h
+++ b/src/GuiLua/GuiLua.h
@@ -20,6 +20,7 @@ typedef struct _GuiLua
20 lua_State *L; 20 lua_State *L;
21 winFang *us; // Our window, if it exists. 21 winFang *us; // Our window, if it exists.
22 winFang *parent; // Our parent window, if it exists. 22 winFang *parent; // Our parent window, if it exists.
23 EPhysics_World *world; // Our world, if it exists.
23 int inDel; 24 int inDel;
24 25
25 Eina_Clist node; 26 Eina_Clist node;
@@ -29,8 +30,8 @@ typedef struct _GuiLua
29 30
30extern const char *glName; 31extern const char *glName;
31 32
32GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent); 33GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world);
33void GuiLuaLoad(char *module, winFang *parent); 34void GuiLuaLoad(char *module, winFang *parent, EPhysics_World *world);
34void GuiLuaDel(GuiLua *gl); 35void GuiLuaDel(GuiLua *gl);
35 36
36#endif 37#endif
diff --git a/src/GuiLua/skang.c b/src/GuiLua/skang.c
index ed6d31f..c116f30 100644
--- a/src/GuiLua/skang.c
+++ b/src/GuiLua/skang.c
@@ -5,7 +5,7 @@
5EAPI_MAIN int elm_main(int argc, char **argv) 5EAPI_MAIN int elm_main(int argc, char **argv)
6{ 6{
7 HamrTime(elm_main, "GuiLua"); 7 HamrTime(elm_main, "GuiLua");
8 GuiLuaDo(argc, argv, NULL); 8 GuiLuaDo(argc, argv, NULL, NULL);
9 9
10 return 0; 10 return 0;
11} 11}