diff options
author | chai <chaifix@163.com> | 2018-11-15 19:29:27 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-15 19:29:27 +0800 |
commit | 7e51ff3bfae0becc260452a427a1fc1232a4b348 (patch) | |
tree | e2c4cddcd5ed719a611be4c92edf1991a63203c5 /bin/game/main.lua | |
parent | a6f2d5fff89b7322009c46a9272668ca4c32ce64 (diff) |
*修改代码结构
Diffstat (limited to 'bin/game/main.lua')
-rw-r--r-- | bin/game/main.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/game/main.lua b/bin/game/main.lua index 35c1695..7c94445 100644 --- a/bin/game/main.lua +++ b/bin/game/main.lua @@ -25,7 +25,7 @@ Vertex vert(Vertex v) Color frag(Color col, Texture tex, Vertex v) { Color c = texel(tex, v.uv); - return c * col; + return c; } #END_FRAGMENT_SHADER ]] @@ -37,11 +37,15 @@ local timer = nil local tb = {x = 1, y = 2} local t = 0 local spr = nil +local bitmap = nil function jin.core.onLoad() - jin.graphics.setClearColor(100, 100, 100, 255) + bitmap = jin.graphics.newBitmap(128, 128, function(w, h, x, y) + return {255*math.sin(x/w),255 - 255*math.cos(y/w),0,255} + end) shader_program = jin.graphics.newShader(shader) shader_program2 = jin.graphics.newShader(shader2) - tex = jin.graphics.newTexture("1.png") + --tex = jin.graphics.newTexture("1.png") + tex = jin.graphics.newTexture(bitmap) local ssheet = jin.graphics.newSpriteSheet(tex) spr = ssheet:newSprite(50, 50, 50, 50) spr:setPosition(0, 50) |