diff options
author | David Walter Seikel | 2014-05-10 14:14:08 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-10 14:14:08 +1000 |
commit | 81283b584a7f7c38b697c438858a8b70294dd276 (patch) | |
tree | fa8eecfb71c369cbeeda38145403be0ab2e6e4c6 /src/GuiLua | |
parent | A note about a useful web site. (diff) | |
download | SledjHamr-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')
-rw-r--r-- | src/GuiLua/GuiLua.c | 16 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.h | 5 | ||||
-rw-r--r-- | src/GuiLua/skang.c | 2 |
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 | ||
375 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | 380 | GuiLua *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 | ||
436 | void GuiLuaLoad(char *module, winFang *parent) | 442 | void 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 | ||
444 | void GuiLuaDel(GuiLua *gl) | 450 | void 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 | ||
30 | extern const char *glName; | 31 | extern const char *glName; |
31 | 32 | ||
32 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent); | 33 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world); |
33 | void GuiLuaLoad(char *module, winFang *parent); | 34 | void GuiLuaLoad(char *module, winFang *parent, EPhysics_World *world); |
34 | void GuiLuaDel(GuiLua *gl); | 35 | void 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 @@ | |||
5 | EAPI_MAIN int elm_main(int argc, char **argv) | 5 | EAPI_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 | } |