Rearange things so the main lua group is the, um, main one,

the edje group is swallowed in that, and the bubbles lua group
is swallowed into the edje group.

Demonstrates all ways of lua swallowing, except direct lua to lua.


SVN revision: 65140
This commit is contained in:
David Walter Seikel 2011-11-14 00:18:41 +00:00
parent f631c2ca09
commit b0716602f1
1 changed files with 48 additions and 48 deletions

View File

@ -12,10 +12,8 @@ images {
} }
collections { collections {
// The group name NEEDS a / in it, group {
// or the part below that tries to swallow it don't work. name: "main";
// Leaving just the lua part visible.
group { name: "example/lua";
lua_script_only: 1; lua_script_only: 1;
lua_script { lua_script {
--// stick object private/local vars here --// stick object private/local vars here
@ -88,6 +86,7 @@ collections {
D.tim = edje.timer(1.23, mycb); D.tim = edje.timer(1.23, mycb);
D.tra = edje.transition(5.0, mycb3); D.tra = edje.transition(5.0, mycb3);
D.ani = edje.animator(mycb2); D.ani = edje.animator(mycb2);
edje_geom = edje.geom();
if (edje.spanky) then edje.spanky(); end if (edje.spanky) then edje.spanky(); end
@ -115,6 +114,10 @@ collections {
edje.messagesend(7, "strint", "hello world", 7); edje.messagesend(7, "strint", "hello world", 7);
edje.messagesend(7, "strfloat", "hello world", 7.654); edje.messagesend(7, "strfloat", "hello world", 7.654);
edje.messagesend(7, "strintset","hello world", {1, 2, 3}); edje.messagesend(7, "strintset","hello world", {1, 2, 3});
D.edje = edje.edje();
D.edje:file("plain/edje/group");
D.edje:show();
D.rect = edje.rect(); D.rect = edje.rect();
D.rect:geom (5, 10, 50, 30); D.rect:geom (5, 10, 50, 30);
@ -237,11 +240,13 @@ collections {
function move (x, y) function move (x, y)
print("lua::move x=" .. x .. " x=" .. y); print("lua::move x=" .. x .. " x=" .. y);
D.edje:move(0, 0);
end end
function resize (w, h) function resize (w, h)
print("lua::resize w=" .. w .. " h=" .. h); print("lua::resize w=" .. w .. " h=" .. h);
D.text:move((w - text_geom.w) / 2, (h - text_geom.h) / 8); D.text:move((w - text_geom.w) / 2, (h - text_geom.h) / 8);
D.edje:resize(w, h);
end end
function message (id, type, v1, v2) function message (id, type, v1, v2)
@ -258,46 +263,47 @@ collections {
} }
} }
group // The group name NEEDS a / in it,
{ name: "bubbles/lua"; // or the part below that tries to swallow it won't work.
lua_script_only: 1; // Leaving just the lua part visible.
lua_script group {
{ name: "bubbles/lua";
local bubbles = { }; lua_script_only: 1;
local bubbleCols = 8; lua_script {
local bubbleRows = 6; local bubbles = { };
local bubbleCols = 8;
local bubbleRows = 6;
for i = 1, bubbleRows do for i = 1, bubbleRows do
row = { }; row = { };
for j = 1, bubbleCols do for j = 1, bubbleCols do
image = edje.image(); image = edje.image();
image:image("bubble.png"); image:image("bubble.png");
image:show(); image:show();
table.insert(row, image); table.insert(row, image);
end end
table.insert(bubbles, row); table.insert(bubbles, row);
end end
function resize (w, h) function resize (w, h)
for i = 1, bubbleRows do for i = 1, bubbleRows do
for j = 1, bubbleCols do for j = 1, bubbleCols do
w1 = w / bubbleCols; w1 = w / bubbleCols;
h1 = h / bubbleRows; h1 = h / bubbleRows;
bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1); bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1);
if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then
bubbles[i][j]:color(0, 255, 0, 200); bubbles[i][j]:color(0, 255, 0, 200);
else else
bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200); bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200);
end end
end end
end end
end end
} }
} }
group { group {
name: "elm/bg/base/default"; name: "plain/edje/group";
parts { parts {
part { part {
name: "background"; name: "background";
@ -309,6 +315,7 @@ collections {
} }
} }
// A lua group embedded in an edje group.
part { part {
name: "bubbles_lua"; name: "bubbles_lua";
type: GROUP; type: GROUP;
@ -319,6 +326,7 @@ collections {
part { part {
name: "background_image"; name: "background_image";
type: IMAGE;
mouse_events: 0; mouse_events: 0;
description { description {
state: "default" 0.0; state: "default" 0.0;
@ -342,14 +350,6 @@ collections {
} }
} }
part {
name: "example_lua";
type: GROUP;
source: "example/lua";
mouse_events: 0;
description { state: "default" 0.0; }
}
} }
} }