-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Björn Ritzl
committed
Sep 16, 2016
1 parent
428b8bb
commit 19ff2ab
Showing
5 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: "default" | ||
scale_along_z: 0 | ||
embedded_instances { | ||
id: "broadcaster" | ||
data: "components {\n" | ||
" id: \"script\"\n" | ||
" component: \"/examples/broadcast/broadcaster.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} | ||
embedded_instances { | ||
id: "receiver1" | ||
data: "components {\n" | ||
" id: \"script\"\n" | ||
" component: \"/examples/broadcast/receiver1.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} | ||
embedded_instances { | ||
id: "receiver2" | ||
data: "components {\n" | ||
" id: \"script\"\n" | ||
" component: \"/examples/broadcast/receiver2.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
local broadcast = require "ludobits.m.broadcast" | ||
|
||
function init(self) | ||
msg.post(".", "acquire_input_focus") | ||
end | ||
|
||
function final(self) | ||
msg.post(".", "release_input_focus") | ||
end | ||
|
||
function on_input(self, action_id, action) | ||
if action.released then | ||
local messages = { "foo", "bar", "boo" } | ||
broadcast.send(messages[math.random(1, #messages)], { time = os.time() }) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
local broadcast = require "ludobits.m.broadcast" | ||
|
||
function init(self) | ||
broadcast.register("foo") | ||
broadcast.register("bar") | ||
end | ||
|
||
function final(self) | ||
broadcast.unregister("foo") | ||
broadcast.unregister("bar") | ||
end | ||
|
||
function on_message(self, message_id, message, sender) | ||
print("Received", message_id) | ||
--pprint(message) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
local broadcast = require "ludobits.m.broadcast" | ||
|
||
local function receive_boo(message) | ||
print("Received boo") | ||
--pprint(message) | ||
end | ||
|
||
function init(self) | ||
broadcast.register("foo") | ||
broadcast.register("boo", receive_boo) | ||
end | ||
|
||
function final(self) | ||
broadcast.unregister("foo") | ||
broadcast.unregister("boo", receive_boo) | ||
end | ||
|
||
function on_message(self, message_id, message, sender) | ||
print("Received", message_id) | ||
--pprint(message) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters