aboutsummaryrefslogtreecommitdiff
path: root/bin/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/main.lua')
-rw-r--r--bin/main.lua33
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