From 7e51ff3bfae0becc260452a427a1fc1232a4b348 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Nov 2018 19:29:27 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/game/main.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bin/game/main.lua') 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) -- cgit v1.1-26-g67d0