Update README examples;

This commit is contained in:
bjorn 2022-09-01 19:10:31 -07:00
parent 2a96fe4766
commit 05250988df
1 changed files with 9 additions and 9 deletions

View File

@ -40,25 +40,25 @@ then write a `main.lua` script and drag its parent folder onto the executable.
#### Hello World #### Hello World
```lua ```lua
function lovr.draw() function lovr.draw(pass)
lovr.graphics.print('Hello World!', 0, 1.7, -3, .5) pass:text('Hello World!', 0, 1.7, -3, .5)
end end
``` ```
#### Spinning Cube #### Spinning Cube
```lua ```lua
function lovr.draw() function lovr.draw(pass)
lovr.graphics.cube('line', 0, 1.7, -1, .5, lovr.timer.getTime()) pass:cube(0, 1.7, -1, .5, lovr.timer.getTime())
end end
``` ```
#### Hand Tracking #### Hand Tracking
```lua ```lua
function lovr.draw() function lovr.draw(pass)
for _, hand in ipairs(lovr.headset.getHands()) do for _, hand in ipairs(lovr.headset.getHands()) do
lovr.graphics.sphere(vec3(lovr.headset.getPosition(hand)), .1) pass:sphere(vec3(lovr.headset.getPosition(hand)), .1)
end end
end end
``` ```
@ -70,12 +70,12 @@ function lovr.load()
model = lovr.graphics.newModel('model.gltf') model = lovr.graphics.newModel('model.gltf')
end end
function lovr.draw() function lovr.draw(pass)
model:draw(x, y, z) pass:draw(model, x, y, z)
end end
``` ```
You can try more examples in your browser on the [docs page](https://lovr.org/docs/Intro/Hello_World). More examples are on the [docs page](https://lovr.org/docs/Intro/Hello_World).
Building Building
--- ---