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
|
||||
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)
|
||||
print("[i] loading ecs")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ local gctl
|
|||
gctl = {
|
||||
|
||||
name = "gctl",
|
||||
enabled = true,
|
||||
enabled = false,
|
||||
dtmax = 1,
|
||||
dt = 0,
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ return {
|
|||
if res.data:lower():match("<fireboxroom>") or res.data:lower():match("<room[ >]") then
|
||||
local JML0
|
||||
local JML
|
||||
print_r(api.parser)
|
||||
res.xml = api.parser.xml.newParser()
|
||||
local xmlstr = res.data
|
||||
-- cleanup JML0
|
||||
|
|
@ -27,7 +26,8 @@ return {
|
|||
api.ext.janusxr.loadXML( JML0, res, obj )
|
||||
end
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ unixy = {
|
|||
stderr_file = stderr_file,
|
||||
callback = callback
|
||||
})
|
||||
trace("[unixy] start job with pid " .. pid .. " => 1> " .. stdout_file .. " 2> " .. stderr_file)
|
||||
trace("[unixy] start job with pid " .. pid .. ": " .. cmd)
|
||||
end,
|
||||
|
||||
check_jobs = function()
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
-- ./lovr xurfer https://janusxr.org/index.html'
|
||||
-- ./lovr xurfer https://snips.sh/f/rHFLg-cewi?r=1' -- cube
|
||||
-- ./lovr xurfer https://snips.sh/f/_U5-XctEVE?r=1' -- cube, monkey, scene
|
||||
|
||||
--
|
||||
print("\n X U R F Ξ R")
|
||||
print(" ⠭ ⠥ ⠗ ⠋ ⠑ ⠗\n")
|
||||
|
||||
package.path = package.path .. ';' .. '?.lua;'
|
||||
package.path = package.path .. ';' .. '?.lua'
|
||||
require('conf')
|
||||
|
||||
local runtime = require("runtime/detect")
|
||||
local util = require("util")
|
||||
local ecs = require("ecs")
|
||||
local ecs = require("ecs")
|
||||
|
||||
api = {
|
||||
runtime = runtime,
|
||||
|
|
|
|||
|
|
@ -6,14 +6,23 @@ local runtime = require("runtime/detect")
|
|||
|
||||
-- setup path
|
||||
print("!!!!!!!")
|
||||
package.path = package.path .. ';' ..
|
||||
'./runtime/lovr/?.lua;' ..
|
||||
'./runtime/lovr/?/init.lua;' ..
|
||||
'./lib/?.lua;' ..
|
||||
'./?.lua'
|
||||
package.path = package.path ..
|
||||
'runtime/lovr/?.lua;' ..
|
||||
'runtime/lovr/?/init.lua;' ..
|
||||
'lib/?.lua;' ..
|
||||
'?.lua'
|
||||
--arg[0] .. 'runtime/lovr/?.lua;' ..
|
||||
--arg[0] .. 'runtime/lovr/?/init.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 launch = require "runtime/lovr/launch"
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ function lovr.draw(pass)
|
|||
end
|
||||
|
||||
function lovr.recenter()
|
||||
if iui.idiom == "vr" then
|
||||
if iui.idiom == "vr" and lovr.headset.isActive() then
|
||||
mainWindow:recenter()
|
||||
end
|
||||
end
|
||||
|
|
@ -178,19 +178,23 @@ function initInteractions(ecs)
|
|||
ecs.worldPhysics:update(dt)
|
||||
|
||||
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
|
||||
for i, hand in ipairs(lovr.headset.getHands()) do
|
||||
if lovr.headset.isDown(hand, 'trigger') then
|
||||
print("buttondown")
|
||||
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
|
||||
local direction = quat(lovr.headset.getOrientation('hand/left/point')):direction()
|
||||
if direction ~= nil then
|
||||
local dx, dy, dz = 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
|
||||
for i, hand in ipairs(lovr.headset.getHands()) do
|
||||
if lovr.headset.isDown(hand, 'trigger') then
|
||||
print("buttondown")
|
||||
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
|
||||
|
|
|
|||
|
|
@ -11,13 +11,6 @@ api.ext.lua = {
|
|||
api.ecs.filterUpdate = api.ecs.requireAll('updatethread')
|
||||
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
|
||||
local current_time = os.clock()
|
||||
local dt = current_time - last_time
|
||||
|
|
@ -38,11 +31,11 @@ api.ext.lua = {
|
|||
-- via wget
|
||||
api.protocol.http.request = api.ext.unixy.proxyCLI(
|
||||
"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)
|
||||
local status = 200
|
||||
if retcode ~= 0 then status = retcode end
|
||||
cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values
|
||||
if retcode ~= 'exit' then status = 500 end
|
||||
cb( status, stdout, {string = stderr, retcode = retcode})
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -52,8 +45,8 @@ api.ext.lua = {
|
|||
function(url,opts, cb) return string.format( "curl -v -s %s", url ) end,
|
||||
function( stdout, stderr, retcode, url, opts, cb)
|
||||
local status = 200
|
||||
if retcode ~= 0 then status = retcode end
|
||||
cb( retcode, stdout, {string = stderr}) -- todo: parse string into key/values
|
||||
if retcode ~= 'exit' then status = 500 end
|
||||
cb( status, stdout, {string = stderr, retcode = retcode})
|
||||
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