diff options
author | chai <chaifix@163.com> | 2018-10-22 21:30:21 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-22 21:30:21 +0800 |
commit | 58d09aa3ca4409e2a15473b0ac3c0446f0acb1a2 (patch) | |
tree | 37dadab5575116c75b54064556b045ba8a245871 /bin/main.lua | |
parent | 99bea1e47c813016d89c9e99296fa66e183d808f (diff) |
*misc
Diffstat (limited to 'bin/main.lua')
-rw-r--r-- | bin/main.lua | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bin/main.lua b/bin/main.lua index 5855766..af78076 100644 --- a/bin/main.lua +++ b/bin/main.lua @@ -13,12 +13,10 @@ function jin.core.onLoad() -- tf = tfdata:newTTF(13) -- page = tf:typeset("this is a test") jin.graphics.setClearColor(100, 100, 100, 255) - local bitmap = jin.graphics.newBitmap("sprites.png") - sprites = jin.graphics.newTexture(bitmap) - bitmap = nil + sprites = jin.graphics.newTexture("sprites.png") -- local ttfdata = jin.graphics.newTTFData("font_pixel.ttf") -- ttf = ttfdata:newTTF(22); - bitmap = jin.graphics.newBitmap("font2.png") + local bitmap = jin.graphics.newBitmap("font2.png") tf = jin.graphics.newTextureFont(bitmap, [[<=>?.'^@abcdefghijklmnopqrstuvwxyz|~[\]_]], {255, 0, 0, 255}, 16) end local value = 0 @@ -49,9 +47,9 @@ function jin.core.onUpdate(dt) end function run() - --#if editor + ---#if editor - --#endif + ---#endif end function jin.core.onDraw() @@ -59,6 +57,7 @@ function jin.core.onDraw() --jin.graphics.draw(sprites, 10, 10, 1, 1) -- jin.graphics.setFont(tf) jin.graphics.useShader(shader) + shader:sendNumber("dt", t) jin.graphics.print(value) jin.graphics.print([[ #VERTEX_SHADER @@ -77,7 +76,7 @@ uniform float dt; Color frag(Color col, Texture tex, Vertex v) { Color c = texel(tex, v.uv); - if(c.a < 0.9f) + if(c.a < 0.9f) { c.a /= 1.34; } @@ -88,7 +87,7 @@ Color frag(Color col, Texture tex, Vertex v) //stbi_write_png #END_FRAGMENT_SHADER - ]], 0, 20)asd + ]], 0, 20) jin.graphics.unuseShader() jin.graphics.print([[ #VERTEX_SHADER @@ -107,7 +106,7 @@ uniform float dt; Color frag(Color col, Texture tex, Vertex v) { Color c = texel(tex, v.uv); - if(c.a < 0.9f) + if(c.a < 0.9f) { c.a /= 1.34; } @@ -119,4 +118,4 @@ Color frag(Color col, Texture tex, Vertex v) #END_FRAGMENT_SHADER ]], 300, 20) -end
\ No newline at end of file +end |