first steps to add LOVE support
This commit is contained in:
parent
49794309af
commit
890c01a8bd
6 changed files with 70 additions and 20 deletions
43
README.md
43
README.md
|
|
@ -1,17 +1,36 @@
|
||||||
|
## Usage
|
||||||
|
|
||||||
## Install
|
Download/run the binaries for your platform in the releases section.<br>
|
||||||
|
Developers can run it via [LÖVR](https://lovr.org) or [LÖVE2D](https://love2d.org)
|
||||||
|
|
||||||
Make sure to [download the loVR runtime](https://lovr.org/downloads) and drag
|
|
||||||
the `src`-folder of this repository to the **lovr** application [as described in the docs](https://lovr.org/downloads)
|
|
||||||
|
|
||||||
If you already have lovr installed, you can run this in your console as well:
|
|
||||||
```
|
```
|
||||||
|
$ love src # if you have LÖVE2D installed (>v12)
|
||||||
|
$ lovr src # if you have LÖVR installed
|
||||||
|
```
|
||||||
|
|
||||||
|
## Multiplatform
|
||||||
|
|
||||||
|
The aim of this project is providing **one [XR Hypermedia browser](https://xrhf.isvery.ninja) codebase** which gracefully degrades between:
|
||||||
|
|
||||||
|
* mac/win/linux/android via [LÖVE2D](https://love2d.org)
|
||||||
|
* mac/win/linux/android via [LÖVR](https://lovr.org)
|
||||||
|
* Web (2D) via [love.js](https://github.com/Davidobot/love.js)
|
||||||
|
* Nintendo 3DS, Switch, and Wii via [lovebrew](https://lovebrew.org/)
|
||||||
|
* Handhelds: Steamdeck, Anbernic, Gameforce, Game Kiddy, Powkiddy (..and more) via [portmaster](https://portmaster.games/supported-devices.html)
|
||||||
|
* Game emulators via [lutro](https://lutro.libretro.com/)
|
||||||
|
* Embedded devices via lua and/oror [nelua](https://nelua.org)
|
||||||
|
|
||||||
|
## Ultra-hackable Extensions
|
||||||
|
|
||||||
|
* XURFER does everything via browser extensions.<br>
|
||||||
|
* XURFER is the total sum of browser extensions.<br>
|
||||||
|
|
||||||
|
So you can strip/bloat however you want, or build one yourself:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cp src/ext/skeleton src/ext/myextension
|
||||||
|
$ sed 's|skeleton|myextension|g' src/ext/myextension/*
|
||||||
$ ./lovr src
|
$ ./lovr src
|
||||||
|
[i] loading 'myextension'
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
or nix:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ appimage-run ./lovr src
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
||||||
12
src/conf.lua
12
src/conf.lua
|
|
@ -1,8 +1,14 @@
|
||||||
|
-- sync lovr/love positional cli arguments
|
||||||
|
if arg[0] == nil and arg[1] ~= nil then arg[0] = arg[1] end
|
||||||
|
|
||||||
package.path = package.path .. ';' ..
|
package.path = package.path .. ';' ..
|
||||||
arg[0] .. '/lovr/?.lua;' ..
|
arg[0] .. '/lovr/?.lua;' ..
|
||||||
arg[0] .. '/lovr/?/init.lua;' ..
|
arg[0] .. '/lovr/?/init.lua;' ..
|
||||||
arg[0] .. '/lib/?.lua'
|
arg[0] .. '/lib/?.lua'
|
||||||
|
|
||||||
if lovr ~= nil then
|
local runtime = ""
|
||||||
require("lovr/conf")
|
|
||||||
end
|
if lovr ~= nil then runtime = "lovr" end
|
||||||
|
if love ~= nil then runtime = "love" end
|
||||||
|
|
||||||
|
require( runtime .. "/conf")
|
||||||
|
|
|
||||||
5
src/love/conf.lua
Normal file
5
src/love/conf.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
function love.conf(t)
|
||||||
|
t.window.width = 1024
|
||||||
|
t.window.height = 720
|
||||||
|
t.window.title = "X U R F Ξ R"
|
||||||
|
end
|
||||||
17
src/love/main.lua
Normal file
17
src/love/main.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
-- Load some default values for our rectangle.
|
||||||
|
function love.load()
|
||||||
|
x, y, w, h = 20, 20, 60, 20
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Increase the size of the rectangle every frame.
|
||||||
|
function love.update(dt)
|
||||||
|
w = w + 1
|
||||||
|
h = h + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Draw a coloured rectangle.
|
||||||
|
function love.draw()
|
||||||
|
-- In versions prior to 11.0, color component values are (0, 102, 102)
|
||||||
|
love.graphics.setColor(0, 0.4, 0.4)
|
||||||
|
love.graphics.rectangle("fill", x, y, w, h)
|
||||||
|
end
|
||||||
11
src/main.lua
11
src/main.lua
|
|
@ -5,15 +5,15 @@ api = {
|
||||||
browser = require("browser"),
|
browser = require("browser"),
|
||||||
url = require("url"),
|
url = require("url"),
|
||||||
util = require("util"),
|
util = require("util"),
|
||||||
protocol = {
|
|
||||||
http = require('http')
|
|
||||||
},
|
|
||||||
ecs = require("tiny-ecs"),
|
ecs = require("tiny-ecs"),
|
||||||
ext = {}, -- all extensions loaded from disk at runtime
|
ext = {}, -- all extensions loaded from disk at runtime
|
||||||
exec = function(...) util.exec(...) end -- calls function on each table item
|
exec = function(...) util.exec(...) end -- calls function on each table item
|
||||||
}
|
}
|
||||||
if lovr ~= nil then
|
if lovr ~= nil then
|
||||||
api = util.merge( api, lovr )
|
api = util.merge( api, lovr )
|
||||||
|
api['protocol'] = {
|
||||||
|
http = require('http')
|
||||||
|
},
|
||||||
util.loaddir( "ext", api, api.ext )
|
util.loaddir( "ext", api, api.ext )
|
||||||
util.loaddir( "media", api, api.media )
|
util.loaddir( "media", api, api.media )
|
||||||
require("lovr/main")
|
require("lovr/main")
|
||||||
|
|
@ -23,4 +23,7 @@ end
|
||||||
local url='https://coderofsalvation.codeberg.page/xrfragment-haxe/example/assets/example.glb?bar=1&f=2#foo'
|
local url='https://coderofsalvation.codeberg.page/xrfragment-haxe/example/assets/example.glb?bar=1&f=2#foo'
|
||||||
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/template/website/website.glb'
|
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/template/website/website.glb'
|
||||||
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/simple-a.glb'
|
--local url = 'https://codeberg.org/coderofsalvation/xrfragment/raw/branch/main/assets/simple-a.glb'
|
||||||
api.browser.to(url)
|
|
||||||
|
if lovr ~= nil then -- TODO: make this work for LOVE2D too
|
||||||
|
api.browser.to(url)
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ util.loaddir = function( path, api, target)
|
||||||
foreach( dir, function(k,v)
|
foreach( dir, function(k,v)
|
||||||
local ext = path .. '/' .. v .. "/main.lua"
|
local ext = path .. '/' .. v .. "/main.lua"
|
||||||
if api.filesystem.isFile(ext) then
|
if api.filesystem.isFile(ext) then
|
||||||
print("[i] found extension '" .. v .. "'")
|
print("[i] loading '" .. v .. "'")
|
||||||
target[ v ] = api.filesystem.load( ext )(api)
|
target[ v ] = api.filesystem.load( ext )(api)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue