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
```lua
function lovr.draw()
lovr.graphics.print('Hello World!', 0, 1.7, -3, .5)
function lovr.draw(pass)
pass:text('Hello World!', 0, 1.7, -3, .5)
end
```
#### Spinning Cube
```lua
function lovr.draw()
lovr.graphics.cube('line', 0, 1.7, -1, .5, lovr.timer.getTime())
function lovr.draw(pass)
pass:cube(0, 1.7, -1, .5, lovr.timer.getTime())
end
```
#### Hand Tracking
```lua
function lovr.draw()
function lovr.draw(pass)
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
```
@ -70,12 +70,12 @@ function lovr.load()
model = lovr.graphics.newModel('model.gltf')
end
function lovr.draw()
model:draw(x, y, z)
function lovr.draw(pass)
pass:draw(model, x, y, z)
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
---