Compare commits

...

2 Commits

Author SHA1 Message Date
Jill afb8d6d1e6 add setShader, setShaderfuck and clearShaderfuck 2022-09-25 15:25:06 +03:00
Jill 88a4ebe180 fix platformer example w/ dt 2022-09-25 15:08:20 +03:00
2 changed files with 9 additions and 6 deletions

View File

@ -288,11 +288,14 @@ local sprite = Sprite('docs/uranium.png')
local shader = Shader('src/shader.frag') -- returns a RageShaderProgram
```
Afterwards, call `SetShader` on your actor. **Use `__raw` on the shader, else it'll pass in the proxy object and break!!!**
Afterwards, call `setShader` on your actor. _Using `:SetShader` will not work._
```lua
function uranium.init()
sprite:SetShader(shader.__raw)
setShader(actor, shader)
-- or
setShaderfuck(shader)
-- (don't forget to clearShaderfuck())
end
```
@ -1091,7 +1094,7 @@ local input = require('stdlib.input')
local DAMPING = 1/9500
local SPEED = 2
local JUMP_FORCE = 32
local GRAVITY = 2.3
local GRAVITY = 123
local PLAYER_SIZE = 50
local groundY = sh * 0.8
@ -1129,7 +1132,7 @@ function uranium.update(dt)
end
-- apply gravity
vel.y = vel.y + GRAVITY
vel.y = vel.y + GRAVITY * dt
-- update position, apply damping to velocity
pos = pos + vel
@ -1271,7 +1274,7 @@ shader:uniform1f('yo', 1)
shader:uniform1f('scale', 0.25)
function uranium.init()
sprite:SetShader(shader.__raw) -- important!!!! we need __raw, else it'll pass in the proxy and error silently
setShader(sprite, shader)
end
function uranium.update()

@ -1 +1 @@
Subproject commit 12edf6cb9a6cf4bad6a896566350bbb094d80cce
Subproject commit 92aa7f33b3875db4bf68ce46a9ff432e7a94fdd1