harmonized lua <-> lovr <-> love imports
This commit is contained in:
parent
14500b44a2
commit
6a995dd3c5
10 changed files with 48 additions and 38 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
-- default argument
|
||||||
|
arg[1] = "https://snips.sh/f/_U5-XctEVE?r=1"
|
||||||
|
|
||||||
-- sync lovr/love positional cli arguments
|
-- sync lovr/love positional cli arguments
|
||||||
if arg[0] == nil and arg[1] ~= nil then arg[0] = arg[1] end
|
if arg[0] == nil and arg[1] ~= nil then arg[0] = arg[1] end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
local ecs = require("tiny-ecs")
|
local ecs = require("lib/tiny-ecs")
|
||||||
|
|
||||||
ecs.init = function(api)
|
ecs.init = function(api)
|
||||||
print("[i] loading ecs")
|
print("[i] loading ecs")
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ local gctl
|
||||||
gctl = {
|
gctl = {
|
||||||
|
|
||||||
name = "gctl",
|
name = "gctl",
|
||||||
enabled = true,
|
enabled = false,
|
||||||
dtmax = 1,
|
dtmax = 1,
|
||||||
dt = 0,
|
dt = 0,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ return {
|
||||||
if res.data:lower():match("<fireboxroom>") or res.data:lower():match("<room[ >]") then
|
if res.data:lower():match("<fireboxroom>") or res.data:lower():match("<room[ >]") then
|
||||||
local JML0
|
local JML0
|
||||||
local JML
|
local JML
|
||||||
print_r(api.parser)
|
|
||||||
res.xml = api.parser.xml.newParser()
|
res.xml = api.parser.xml.newParser()
|
||||||
local xmlstr = res.data
|
local xmlstr = res.data
|
||||||
-- cleanup JML0
|
-- cleanup JML0
|
||||||
|
|
@ -27,7 +26,8 @@ return {
|
||||||
api.ext.janusxr.loadXML( JML0, res, obj )
|
api.ext.janusxr.loadXML( JML0, res, obj )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("[janusxr] error: could not load " .. obj.URI.url .. ": " .. (obj.URLResponse.data or '') )
|
print("[janusxr] error: could not load " .. obj.URI.url .. ": ")
|
||||||
|
print_r(obj.URLResponse)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ unixy = {
|
||||||
stderr_file = stderr_file,
|
stderr_file = stderr_file,
|
||||||
callback = callback
|
callback = callback
|
||||||
})
|
})
|
||||||
trace("[unixy] start job with pid " .. pid .. " => 1> " .. stdout_file .. " 2> " .. stderr_file)
|
trace("[unixy] start job with pid " .. pid .. ": " .. cmd)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
check_jobs = function()
|
check_jobs = function()
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,16 @@
|
||||||
-- ./lovr xurfer https://janusxr.org/index.html'
|
-- ./lovr xurfer https://janusxr.org/index.html'
|
||||||
-- ./lovr xurfer https://snips.sh/f/rHFLg-cewi?r=1' -- cube
|
-- ./lovr xurfer https://snips.sh/f/rHFLg-cewi?r=1' -- cube
|
||||||
-- ./lovr xurfer https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene
|
-- ./lovr xurfer https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene
|
||||||
|
--
|
||||||
print("\n X U R F Ξ R")
|
print("\n X U R F Ξ R")
|
||||||
print(" ⠭ ⠥ ⠗ ⠋ ⠑ ⠗\n")
|
print(" ⠭ ⠥ ⠗ ⠋ ⠑ ⠗\n")
|
||||||
|
|
||||||
package.path = package.path .. ';' .. '?.lua;'
|
package.path = package.path .. ';' .. '?.lua'
|
||||||
require('conf')
|
require('conf')
|
||||||
|
|
||||||
local runtime = require("runtime/detect")
|
local runtime = require("runtime/detect")
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
local ecs = require("ecs")
|
local ecs = require("ecs")
|
||||||
|
|
||||||
api = {
|
api = {
|
||||||
runtime = runtime,
|
runtime = runtime,
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,23 @@ local runtime = require("runtime/detect")
|
||||||
|
|
||||||
-- setup path
|
-- setup path
|
||||||
print("!!!!!!!")
|
print("!!!!!!!")
|
||||||
package.path = package.path .. ';' ..
|
package.path = package.path ..
|
||||||
'./runtime/lovr/?.lua;' ..
|
'runtime/lovr/?.lua;' ..
|
||||||
'./runtime/lovr/?/init.lua;' ..
|
'runtime/lovr/?/init.lua;' ..
|
||||||
'./lib/?.lua;' ..
|
'lib/?.lua;' ..
|
||||||
'./?.lua'
|
'?.lua'
|
||||||
--arg[0] .. 'runtime/lovr/?.lua;' ..
|
--arg[0] .. 'runtime/lovr/?.lua;' ..
|
||||||
--arg[0] .. 'runtime/lovr/?/init.lua;' ..
|
--arg[0] .. 'runtime/lovr/?/init.lua;' ..
|
||||||
--arg[0] .. 'lib/?.lua;' ..
|
--arg[0] .. 'lib/?.lua;' ..
|
||||||
|
lovr.filesystem.setRequirePath(
|
||||||
|
lovr.filesystem.getRequirePath() .. ";" ..
|
||||||
|
'runtime/lovr/?.lua;' ..
|
||||||
|
'runtime/lovr/?/init.lua;' ..
|
||||||
|
'lib/?.lua;' ..
|
||||||
|
'?.lua'
|
||||||
|
)
|
||||||
|
|
||||||
|
print(lovr.filesystem.getRequirePath())
|
||||||
|
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
local launch = require "runtime/lovr/launch"
|
local launch = require "runtime/lovr/launch"
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ function lovr.draw(pass)
|
||||||
end
|
end
|
||||||
|
|
||||||
function lovr.recenter()
|
function lovr.recenter()
|
||||||
if iui.idiom == "vr" then
|
if iui.idiom == "vr" and lovr.headset.isActive() then
|
||||||
mainWindow:recenter()
|
mainWindow:recenter()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -178,19 +178,23 @@ function initInteractions(ecs)
|
||||||
ecs.worldPhysics:update(dt)
|
ecs.worldPhysics:update(dt)
|
||||||
|
|
||||||
local ox, oy, oz = lovr.headset.getPosition('hand/left/point')
|
local ox, oy, oz = lovr.headset.getPosition('hand/left/point')
|
||||||
local dx, dy, dz = quat(lovr.headset.getOrientation('hand/left/point')):direction():mul(50):unpack()
|
|
||||||
local collider, shape, x, y, z = ecs.worldPhysics:raycast(ox, oy, oz, ox + dx, oy + dy, oz + dz)
|
|
||||||
|
|
||||||
if collider then
|
local direction = quat(lovr.headset.getOrientation('hand/left/point')):direction()
|
||||||
for i, hand in ipairs(lovr.headset.getHands()) do
|
if direction ~= nil then
|
||||||
if lovr.headset.isDown(hand, 'trigger') then
|
local dx, dy, dz = direction:mul(50):unpack()
|
||||||
print("buttondown")
|
local collider, shape, x, y, z = ecs.worldPhysics:raycast(ox, oy, oz, ox + dx, oy + dy, oz + dz)
|
||||||
end
|
|
||||||
if lovr.headset.wasReleased(hand, 'trigger') or interactionsUpdater['mouse']['released'] then
|
if collider then
|
||||||
local node = collider:getUserData()
|
for i, hand in ipairs(lovr.headset.getHands()) do
|
||||||
interactionsUpdater.selectedBox = collider
|
if lovr.headset.isDown(hand, 'trigger') then
|
||||||
interactionsUpdater.hitpoint:set(x, y, z)
|
print("buttondown")
|
||||||
if node.onclick ~= nil then node.onclick(node,collider) end
|
end
|
||||||
|
if lovr.headset.wasReleased(hand, 'trigger') or interactionsUpdater['mouse']['released'] then
|
||||||
|
local node = collider:getUserData()
|
||||||
|
interactionsUpdater.selectedBox = collider
|
||||||
|
interactionsUpdater.hitpoint:set(x, y, z)
|
||||||
|
if node.onclick ~= nil then node.onclick(node,collider) end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,6 @@ api.ext.lua = {
|
||||||
api.ecs.filterUpdate = api.ecs.requireAll('updatethread')
|
api.ecs.filterUpdate = api.ecs.requireAll('updatethread')
|
||||||
api.ecs.filterDraw = api.ecs.requireAll('drawthread')
|
api.ecs.filterDraw = api.ecs.requireAll('drawthread')
|
||||||
|
|
||||||
api.protocol.http.request( "https://2wa.isvery.ninja", {}, function(status,data,headers)
|
|
||||||
print("request done")
|
|
||||||
--print_r(status)
|
|
||||||
--print_r(headers)
|
|
||||||
--print_r(data)
|
|
||||||
end)
|
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
local current_time = os.clock()
|
local current_time = os.clock()
|
||||||
local dt = current_time - last_time
|
local dt = current_time - last_time
|
||||||
|
|
@ -38,11 +31,11 @@ api.ext.lua = {
|
||||||
-- via wget
|
-- via wget
|
||||||
api.protocol.http.request = api.ext.unixy.proxyCLI(
|
api.protocol.http.request = api.ext.unixy.proxyCLI(
|
||||||
"wget",
|
"wget",
|
||||||
function(url,opts, cb) return string.format( "out=$(mktemp); wget -O $out https://2wa.isvery.ninja; cat $out; rm $out", url ) end,
|
function(url,opts, cb) return string.format( "out=$(mktemp); wget -O $out %s; cat $out; rm $out", url ) end,
|
||||||
function( stdout, stderr, retcode, url, opts, cb)
|
function( stdout, stderr, retcode, url, opts, cb)
|
||||||
local status = 200
|
local status = 200
|
||||||
if retcode ~= 0 then status = retcode end
|
if retcode ~= 'exit' then status = 500 end
|
||||||
cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values
|
cb( status, stdout, {string = stderr, retcode = retcode})
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -52,8 +45,8 @@ api.ext.lua = {
|
||||||
function(url,opts, cb) return string.format( "curl -v -s %s", url ) end,
|
function(url,opts, cb) return string.format( "curl -v -s %s", url ) end,
|
||||||
function( stdout, stderr, retcode, url, opts, cb)
|
function( stdout, stderr, retcode, url, opts, cb)
|
||||||
local status = 200
|
local status = 200
|
||||||
if retcode ~= 0 then status = retcode end
|
if retcode ~= 'exit' then status = 500 end
|
||||||
cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values
|
cb( status, stdout, {string = stderr, retcode = retcode})
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
1
xurfer/test.localhost.jml0
Symbolic link
1
xurfer/test.localhost.jml0
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../test.localhost.jml0
|
||||||
Loading…
Add table
Reference in a new issue