diff options
author | chai <chaifix@163.com> | 2018-09-05 22:40:20 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-05 22:40:20 +0800 |
commit | ea88790b539f80e1d41bba268136d78357aa87d1 (patch) | |
tree | 464a4808fd791b3aae499aaeb0bb73ea09236dc8 /bin/main.lua | |
parent | 3c74f0147d2e2e12ad5a163d3ed1a1e8dab76743 (diff) |
*update
Diffstat (limited to 'bin/main.lua')
-rw-r--r-- | bin/main.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/main.lua b/bin/main.lua new file mode 100644 index 0000000..89a8c01 --- /dev/null +++ b/bin/main.lua @@ -0,0 +1,33 @@ +local shader; +local program = [[ +extern Texture img; +extern number dt; +Color effect(Color col, Texture tex, vec2 uv, vec2 screen) +{ + //return vec4(1, 0, 1, 1); + return sin(dt)*Texel(tex, uv) * Texel(img, uv); +} +]] +local img +local img2 +function jin.core.onLoad() + shader = jin.graphics.newShader(program) + img = jin.graphics.newTexture("img.png") + img2 = jin.graphics.newTexture("img2.bmp") +end + +function jin.core.onEvent(e) + if e.type == "quit" then + jin.core.stop() + end +end + +local dt = 0 +function jin.core.onDraw() + dt = dt + 0.1 + jin.graphics.useShader(shader) + shader:sendTexture("img", img2) + shader:sendNumber("dt", dt) + jin.graphics.draw(img, 0, 0) + jin.graphics.unuseShader() +end
\ No newline at end of file |