Skip to content

Commit

Permalink
Multiple changes:
Browse files Browse the repository at this point in the history
* Added input mapper
* Moved many files
* Added examples start page
  • Loading branch information
britzl committed Dec 30, 2017
1 parent 4a34dcf commit 568403d
Show file tree
Hide file tree
Showing 37 changed files with 3,342 additions and 245 deletions.
15 changes: 12 additions & 3 deletions .test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,39 @@ else
PLATFORM="$1"
fi


echo "${PLATFORM}"

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

#DMENGINE_URL="http://d.defold.com/archive/${SHA1}/engine/linux/dmengine_headless"
# Create dmengine_headless and bob.jar URLs
DMENGINE_URL="http://d.defold.com/archive/${SHA1}/engine/${PLATFORM}/dmengine_headless"
BOB_URL="http://d.defold.com/archive/${SHA1}/bob/bob.jar"

# Download dmengine_headless
echo "Downloading ${DMENGINE_URL}"
curl -o dmengine_headless ${DMENGINE_URL}
chmod +x dmengine_headless

# Download bob.jar
echo "Downloading ${BOB_URL}"
curl -o bob.jar ${BOB_URL}

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

echo "Running bob.jar - building"
java -jar bob.jar --debug build
java -jar bob.jar --debug build --keep-unused

echo "Starting dmengine_headless"
./dmengine_headless
if [ -n "${DEFOLD_BOOSTRAP_COLLECTION}" ]; then
./dmengine_headless --config=bootstrap.main_collection=${DEFOLD_BOOSTRAP_COLLECTION}
else
./dmengine_headless
fi
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
global:
- secure: "xv5FUth6u7OqKWCtxaNpffDpwGhfNF4frgUXmRvao8hCzJyWwcOI9eMMes+CoKbqnJRbX0BssU0fbsQG8W32Ia+9+RJd0wkcKS1MydmUvzPhXuhDbkt+CWNgDjR+61w6hwdoRpJ98SGVTVxk8uXtGtAFkZaSwQTOEWxNzrMs1/D9mh56Xk0RQUNXnAU8VV8xMEnqk+DnDt124dZOe10qEZBcRGV8Jf4edpbJ1LrpVblFE6m+F6poWedirfGKcAUjxbCSombPqoPY1AwKrJzEZis3GZYVLO4vZ6Sxq1TqEToAg+50Qd0cw2EXVoP+Bw3yAH040ox+9RDW2+NYg2TODufrOCXcsq9Dbo7OmQXr3gkGFkUfi0lCYFv9MInflsGdeFjiSi0ubZulE3xaJ9ayc1dxVqpARhfkQJX6KVQTzGpmX1NigBqYcyA56l7amSErsen3Y+PxL/YJiDJRzI8GlxXu6Rap2x7ZOk9FANAM0Ev82lTcyCJdz4VA7Jy8qk1vBNdTNR8Zufp+8UOFOfuN0kbCrWZ4nkmYgnmIT2jKSGxNzhAj1sPBnrYLZlLXigPv7k9NYDZM2qcl039Dlzypn6wxMxwQwqKMDd9kshHx48vPD87xCZXu0P2NrRqvg0qT0scFmCRPD38RWvXGiCfVIteQLQkBlq3iWcl3JUWjVv8="
- [email protected]
- DEFOLD_BOOSTRAP_COLLECTION=/test/test.collectionc

script:
- "./.test/run.sh"
9 changes: 0 additions & 9 deletions circle.yml

This file was deleted.

10 changes: 8 additions & 2 deletions examples/assets/button.gui
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ nodes {
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
layer: "below"
inherit_alpha: true
slice9 {
x: 6.0
Expand Down Expand Up @@ -121,7 +121,7 @@ nodes {
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button"
layer: ""
layer: "text"
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
Expand All @@ -130,6 +130,12 @@ nodes {
text_leading: 1.0
text_tracking: 0.0
}
layers {
name: "below"
}
layers {
name: "text"
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512
26 changes: 20 additions & 6 deletions examples/dynamic/dynamic.script
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
local dynamic = require "ludobits.m.dynamic"
local input = require "ludobits.m.input"
local dynamic = require "ludobits.m.physics.dynamic"
local input = require "ludobits.m.input.state"
local mapper = require "ludobits.m.input.mapper"

local LEFT = hash("left")
local RIGHT = hash("right")
local UP = hash("up")
local DOWN = hash("down")

function init(self)
input.acquire()
mapper.bind(mapper.KEY_LEFT, LEFT)
mapper.bind(mapper.KEY_RIGHT, RIGHT)
mapper.bind(mapper.KEY_UP, UP)
mapper.bind(mapper.KEY_DOWN, DOWN)
mapper.bind(mapper.KEY_A, LEFT)
mapper.bind(mapper.KEY_D, RIGHT)
mapper.bind(mapper.KEY_W, UP)
mapper.bind(mapper.KEY_S, DOWN)
end

function final(self)
input.release()
end

function update(self, dt)
if input.is_pressed(hash("left")) then
if input.is_pressed(LEFT) then
dynamic.rotate("#collisionobject", vmath.vector3(0, -1000, 0) * dt)
elseif input.is_pressed(hash("right")) then
elseif input.is_pressed(RIGHT) then
dynamic.rotate("#collisionobject", vmath.vector3(0, 1000, 0) * dt)
else
dynamic.stop_rotating("#collisionobject")
end

if input.is_pressed(hash("up")) then
if input.is_pressed(UP) then
dynamic.forward("#collisionobject", vmath.vector3(0, 10000, 0) * dt)
elseif input.is_pressed(hash("down")) then
elseif input.is_pressed(DOWN) then
dynamic.backwards("#collisionobject", vmath.vector3(0, 10000, 0) * dt)
else
dynamic.stop_moving("#collisionobject")
end
end

function on_input(self, action_id, action)
action_id = mapper.on_input(action_id)
input.on_input(action_id, action)
if action_id == hash("toggle_physics_debug") and action.released then
msg.post("@system:", "toggle_physics_debug")
Expand Down
235 changes: 235 additions & 0 deletions examples/examples.collection
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
name: "examples"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"examples\"\n"
" component: \"/examples/examples.gui\"\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"
"embedded_components {\n"
" id: \"bezierproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/bezier/bezier.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"broadcastproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/broadcast/broadcast.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"dynamicproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/dynamic/dynamic.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"flowproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/flow/flow.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"gestureproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/gesture/gesture.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"kinematicproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/kinematic/kinematic.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"listenerproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/listener/listener.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"platformerproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/platformer/platformer.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"ray_castproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/ray_cast/ray_cast.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"savefileproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/savefile/savefile.collection\\\"\\n"
"exclude: false\\n"
"\"\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"
"embedded_components {\n"
" id: \"savetableproxy\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/savetable/savetable.collection\\\"\\n"
"exclude: false\\n"
"\"\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
}
}
Loading

0 comments on commit 568403d

Please sign in to comment.