Skip to content

Commit 568403d

Browse files
committed
Multiple changes:
* Added input mapper * Moved many files * Added examples start page
1 parent 4a34dcf commit 568403d

37 files changed

+3342
-245
lines changed

.test/run.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,39 @@ else
55
PLATFORM="$1"
66
fi
77

8+
89
echo "${PLATFORM}"
910

1011
# {"version": "1.2.89", "sha1": "5ca3dd134cc960c35ecefe12f6dc81a48f212d40"}
12+
# Get SHA1 of the current Defold stable release
1113
SHA1=$(curl -s http://d.defold.com/stable/info.json | sed 's/.*sha1": "\(.*\)".*/\1/')
1214
echo "Using Defold dmengine_headless version ${SHA1}"
1315

14-
#DMENGINE_URL="http://d.defold.com/archive/${SHA1}/engine/linux/dmengine_headless"
16+
# Create dmengine_headless and bob.jar URLs
1517
DMENGINE_URL="http://d.defold.com/archive/${SHA1}/engine/${PLATFORM}/dmengine_headless"
1618
BOB_URL="http://d.defold.com/archive/${SHA1}/bob/bob.jar"
1719

20+
# Download dmengine_headless
1821
echo "Downloading ${DMENGINE_URL}"
1922
curl -o dmengine_headless ${DMENGINE_URL}
2023
chmod +x dmengine_headless
2124

25+
# Download bob.jar
2226
echo "Downloading ${BOB_URL}"
2327
curl -o bob.jar ${BOB_URL}
2428

29+
# Fetch libraries if DEFOLD_AUTH and DEFOLD_USER are set
2530
if [ -n "${DEFOLD_AUTH}" ] && [ -n "${DEFOLD_USER}" ]; then
2631
echo "Running bob.jar - resolving dependencies"
2732
java -jar bob.jar --auth "${DEFOLD_AUTH}" --email "${DEFOLD_USER}" resolve
2833
fi
2934

3035
echo "Running bob.jar - building"
31-
java -jar bob.jar --debug build
36+
java -jar bob.jar --debug build --keep-unused
3237

3338
echo "Starting dmengine_headless"
34-
./dmengine_headless
39+
if [ -n "${DEFOLD_BOOSTRAP_COLLECTION}" ]; then
40+
./dmengine_headless --config=bootstrap.main_collection=${DEFOLD_BOOSTRAP_COLLECTION}
41+
else
42+
./dmengine_headless
43+
fi

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
global:
2222
- secure: "xv5FUth6u7OqKWCtxaNpffDpwGhfNF4frgUXmRvao8hCzJyWwcOI9eMMes+CoKbqnJRbX0BssU0fbsQG8W32Ia+9+RJd0wkcKS1MydmUvzPhXuhDbkt+CWNgDjR+61w6hwdoRpJ98SGVTVxk8uXtGtAFkZaSwQTOEWxNzrMs1/D9mh56Xk0RQUNXnAU8VV8xMEnqk+DnDt124dZOe10qEZBcRGV8Jf4edpbJ1LrpVblFE6m+F6poWedirfGKcAUjxbCSombPqoPY1AwKrJzEZis3GZYVLO4vZ6Sxq1TqEToAg+50Qd0cw2EXVoP+Bw3yAH040ox+9RDW2+NYg2TODufrOCXcsq9Dbo7OmQXr3gkGFkUfi0lCYFv9MInflsGdeFjiSi0ubZulE3xaJ9ayc1dxVqpARhfkQJX6KVQTzGpmX1NigBqYcyA56l7amSErsen3Y+PxL/YJiDJRzI8GlxXu6Rap2x7ZOk9FANAM0Ev82lTcyCJdz4VA7Jy8qk1vBNdTNR8Zufp+8UOFOfuN0kbCrWZ4nkmYgnmIT2jKSGxNzhAj1sPBnrYLZlLXigPv7k9NYDZM2qcl039Dlzypn6wxMxwQwqKMDd9kshHx48vPD87xCZXu0P2NrRqvg0qT0scFmCRPD38RWvXGiCfVIteQLQkBlq3iWcl3JUWjVv8="
2323
24+
- DEFOLD_BOOSTRAP_COLLECTION=/test/test.collectionc
2425

2526
script:
2627
- "./.test/run.sh"

circle.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/assets/button.gui

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ nodes {
5252
yanchor: YANCHOR_NONE
5353
pivot: PIVOT_CENTER
5454
adjust_mode: ADJUST_MODE_FIT
55-
layer: ""
55+
layer: "below"
5656
inherit_alpha: true
5757
slice9 {
5858
x: 6.0
@@ -121,7 +121,7 @@ nodes {
121121
adjust_mode: ADJUST_MODE_FIT
122122
line_break: false
123123
parent: "button"
124-
layer: ""
124+
layer: "text"
125125
inherit_alpha: true
126126
alpha: 1.0
127127
outline_alpha: 1.0
@@ -130,6 +130,12 @@ nodes {
130130
text_leading: 1.0
131131
text_tracking: 0.0
132132
}
133+
layers {
134+
name: "below"
135+
}
136+
layers {
137+
name: "text"
138+
}
133139
material: "/builtins/materials/gui.material"
134140
adjust_reference: ADJUST_REFERENCE_PARENT
135141
max_nodes: 512

examples/dynamic/dynamic.script

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
1-
local dynamic = require "ludobits.m.dynamic"
2-
local input = require "ludobits.m.input"
1+
local dynamic = require "ludobits.m.physics.dynamic"
2+
local input = require "ludobits.m.input.state"
3+
local mapper = require "ludobits.m.input.mapper"
34

5+
local LEFT = hash("left")
6+
local RIGHT = hash("right")
7+
local UP = hash("up")
8+
local DOWN = hash("down")
49

510
function init(self)
611
input.acquire()
12+
mapper.bind(mapper.KEY_LEFT, LEFT)
13+
mapper.bind(mapper.KEY_RIGHT, RIGHT)
14+
mapper.bind(mapper.KEY_UP, UP)
15+
mapper.bind(mapper.KEY_DOWN, DOWN)
16+
mapper.bind(mapper.KEY_A, LEFT)
17+
mapper.bind(mapper.KEY_D, RIGHT)
18+
mapper.bind(mapper.KEY_W, UP)
19+
mapper.bind(mapper.KEY_S, DOWN)
720
end
821

922
function final(self)
1023
input.release()
1124
end
1225

1326
function update(self, dt)
14-
if input.is_pressed(hash("left")) then
27+
if input.is_pressed(LEFT) then
1528
dynamic.rotate("#collisionobject", vmath.vector3(0, -1000, 0) * dt)
16-
elseif input.is_pressed(hash("right")) then
29+
elseif input.is_pressed(RIGHT) then
1730
dynamic.rotate("#collisionobject", vmath.vector3(0, 1000, 0) * dt)
1831
else
1932
dynamic.stop_rotating("#collisionobject")
2033
end
2134

22-
if input.is_pressed(hash("up")) then
35+
if input.is_pressed(UP) then
2336
dynamic.forward("#collisionobject", vmath.vector3(0, 10000, 0) * dt)
24-
elseif input.is_pressed(hash("down")) then
37+
elseif input.is_pressed(DOWN) then
2538
dynamic.backwards("#collisionobject", vmath.vector3(0, 10000, 0) * dt)
2639
else
2740
dynamic.stop_moving("#collisionobject")
2841
end
2942
end
3043

3144
function on_input(self, action_id, action)
45+
action_id = mapper.on_input(action_id)
3246
input.on_input(action_id, action)
3347
if action_id == hash("toggle_physics_debug") and action.released then
3448
msg.post("@system:", "toggle_physics_debug")

examples/examples.collection

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
name: "examples"
2+
scale_along_z: 0
3+
embedded_instances {
4+
id: "go"
5+
data: "components {\n"
6+
" id: \"examples\"\n"
7+
" component: \"/examples/examples.gui\"\n"
8+
" position {\n"
9+
" x: 0.0\n"
10+
" y: 0.0\n"
11+
" z: 0.0\n"
12+
" }\n"
13+
" rotation {\n"
14+
" x: 0.0\n"
15+
" y: 0.0\n"
16+
" z: 0.0\n"
17+
" w: 1.0\n"
18+
" }\n"
19+
"}\n"
20+
"embedded_components {\n"
21+
" id: \"bezierproxy\"\n"
22+
" type: \"collectionproxy\"\n"
23+
" data: \"collection: \\\"/examples/bezier/bezier.collection\\\"\\n"
24+
"exclude: false\\n"
25+
"\"\n"
26+
" position {\n"
27+
" x: 0.0\n"
28+
" y: 0.0\n"
29+
" z: 0.0\n"
30+
" }\n"
31+
" rotation {\n"
32+
" x: 0.0\n"
33+
" y: 0.0\n"
34+
" z: 0.0\n"
35+
" w: 1.0\n"
36+
" }\n"
37+
"}\n"
38+
"embedded_components {\n"
39+
" id: \"broadcastproxy\"\n"
40+
" type: \"collectionproxy\"\n"
41+
" data: \"collection: \\\"/examples/broadcast/broadcast.collection\\\"\\n"
42+
"exclude: false\\n"
43+
"\"\n"
44+
" position {\n"
45+
" x: 0.0\n"
46+
" y: 0.0\n"
47+
" z: 0.0\n"
48+
" }\n"
49+
" rotation {\n"
50+
" x: 0.0\n"
51+
" y: 0.0\n"
52+
" z: 0.0\n"
53+
" w: 1.0\n"
54+
" }\n"
55+
"}\n"
56+
"embedded_components {\n"
57+
" id: \"dynamicproxy\"\n"
58+
" type: \"collectionproxy\"\n"
59+
" data: \"collection: \\\"/examples/dynamic/dynamic.collection\\\"\\n"
60+
"exclude: false\\n"
61+
"\"\n"
62+
" position {\n"
63+
" x: 0.0\n"
64+
" y: 0.0\n"
65+
" z: 0.0\n"
66+
" }\n"
67+
" rotation {\n"
68+
" x: 0.0\n"
69+
" y: 0.0\n"
70+
" z: 0.0\n"
71+
" w: 1.0\n"
72+
" }\n"
73+
"}\n"
74+
"embedded_components {\n"
75+
" id: \"flowproxy\"\n"
76+
" type: \"collectionproxy\"\n"
77+
" data: \"collection: \\\"/examples/flow/flow.collection\\\"\\n"
78+
"exclude: false\\n"
79+
"\"\n"
80+
" position {\n"
81+
" x: 0.0\n"
82+
" y: 0.0\n"
83+
" z: 0.0\n"
84+
" }\n"
85+
" rotation {\n"
86+
" x: 0.0\n"
87+
" y: 0.0\n"
88+
" z: 0.0\n"
89+
" w: 1.0\n"
90+
" }\n"
91+
"}\n"
92+
"embedded_components {\n"
93+
" id: \"gestureproxy\"\n"
94+
" type: \"collectionproxy\"\n"
95+
" data: \"collection: \\\"/examples/gesture/gesture.collection\\\"\\n"
96+
"exclude: false\\n"
97+
"\"\n"
98+
" position {\n"
99+
" x: 0.0\n"
100+
" y: 0.0\n"
101+
" z: 0.0\n"
102+
" }\n"
103+
" rotation {\n"
104+
" x: 0.0\n"
105+
" y: 0.0\n"
106+
" z: 0.0\n"
107+
" w: 1.0\n"
108+
" }\n"
109+
"}\n"
110+
"embedded_components {\n"
111+
" id: \"kinematicproxy\"\n"
112+
" type: \"collectionproxy\"\n"
113+
" data: \"collection: \\\"/examples/kinematic/kinematic.collection\\\"\\n"
114+
"exclude: false\\n"
115+
"\"\n"
116+
" position {\n"
117+
" x: 0.0\n"
118+
" y: 0.0\n"
119+
" z: 0.0\n"
120+
" }\n"
121+
" rotation {\n"
122+
" x: 0.0\n"
123+
" y: 0.0\n"
124+
" z: 0.0\n"
125+
" w: 1.0\n"
126+
" }\n"
127+
"}\n"
128+
"embedded_components {\n"
129+
" id: \"listenerproxy\"\n"
130+
" type: \"collectionproxy\"\n"
131+
" data: \"collection: \\\"/examples/listener/listener.collection\\\"\\n"
132+
"exclude: false\\n"
133+
"\"\n"
134+
" position {\n"
135+
" x: 0.0\n"
136+
" y: 0.0\n"
137+
" z: 0.0\n"
138+
" }\n"
139+
" rotation {\n"
140+
" x: 0.0\n"
141+
" y: 0.0\n"
142+
" z: 0.0\n"
143+
" w: 1.0\n"
144+
" }\n"
145+
"}\n"
146+
"embedded_components {\n"
147+
" id: \"platformerproxy\"\n"
148+
" type: \"collectionproxy\"\n"
149+
" data: \"collection: \\\"/examples/platformer/platformer.collection\\\"\\n"
150+
"exclude: false\\n"
151+
"\"\n"
152+
" position {\n"
153+
" x: 0.0\n"
154+
" y: 0.0\n"
155+
" z: 0.0\n"
156+
" }\n"
157+
" rotation {\n"
158+
" x: 0.0\n"
159+
" y: 0.0\n"
160+
" z: 0.0\n"
161+
" w: 1.0\n"
162+
" }\n"
163+
"}\n"
164+
"embedded_components {\n"
165+
" id: \"ray_castproxy\"\n"
166+
" type: \"collectionproxy\"\n"
167+
" data: \"collection: \\\"/examples/ray_cast/ray_cast.collection\\\"\\n"
168+
"exclude: false\\n"
169+
"\"\n"
170+
" position {\n"
171+
" x: 0.0\n"
172+
" y: 0.0\n"
173+
" z: 0.0\n"
174+
" }\n"
175+
" rotation {\n"
176+
" x: 0.0\n"
177+
" y: 0.0\n"
178+
" z: 0.0\n"
179+
" w: 1.0\n"
180+
" }\n"
181+
"}\n"
182+
"embedded_components {\n"
183+
" id: \"savefileproxy\"\n"
184+
" type: \"collectionproxy\"\n"
185+
" data: \"collection: \\\"/examples/savefile/savefile.collection\\\"\\n"
186+
"exclude: false\\n"
187+
"\"\n"
188+
" position {\n"
189+
" x: 0.0\n"
190+
" y: 0.0\n"
191+
" z: 0.0\n"
192+
" }\n"
193+
" rotation {\n"
194+
" x: 0.0\n"
195+
" y: 0.0\n"
196+
" z: 0.0\n"
197+
" w: 1.0\n"
198+
" }\n"
199+
"}\n"
200+
"embedded_components {\n"
201+
" id: \"savetableproxy\"\n"
202+
" type: \"collectionproxy\"\n"
203+
" data: \"collection: \\\"/examples/savetable/savetable.collection\\\"\\n"
204+
"exclude: false\\n"
205+
"\"\n"
206+
" position {\n"
207+
" x: 0.0\n"
208+
" y: 0.0\n"
209+
" z: 0.0\n"
210+
" }\n"
211+
" rotation {\n"
212+
" x: 0.0\n"
213+
" y: 0.0\n"
214+
" z: 0.0\n"
215+
" w: 1.0\n"
216+
" }\n"
217+
"}\n"
218+
""
219+
position {
220+
x: 0.0
221+
y: 0.0
222+
z: 0.0
223+
}
224+
rotation {
225+
x: 0.0
226+
y: 0.0
227+
z: 0.0
228+
w: 1.0
229+
}
230+
scale3 {
231+
x: 1.0
232+
y: 1.0
233+
z: 1.0
234+
}
235+
}

0 commit comments

Comments
 (0)