diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Jin.exe | bin | 1560576 -> 524800 bytes | |||
-rw-r--r-- | bin/font.png | bin | 0 -> 2780 bytes | |||
-rw-r--r-- | bin/font.shader (renamed from bin/metaball.shader) | 7 | ||||
-rw-r--r-- | bin/font2.png | bin | 0 -> 3349 bytes | |||
-rw-r--r-- | bin/jin.exe | bin | 1560576 -> 524800 bytes | |||
-rw-r--r-- | bin/main.lua | 59 |
6 files changed, 14 insertions, 52 deletions
diff --git a/bin/Jin.exe b/bin/Jin.exe Binary files differindex a9da499..e30c82c 100644 --- a/bin/Jin.exe +++ b/bin/Jin.exe diff --git a/bin/font.png b/bin/font.png Binary files differnew file mode 100644 index 0000000..151b992 --- /dev/null +++ b/bin/font.png diff --git a/bin/metaball.shader b/bin/font.shader index 67be889..f35e47e 100644 --- a/bin/metaball.shader +++ b/bin/font.shader @@ -1,10 +1,7 @@ #VERTEX_SHADER -uniform float dt; Vertex vert(Vertex v) { - if(v.xy.x > 3) - v.xy += vec2(100, 100) * sin(dt); return v; } @@ -16,9 +13,7 @@ uniform float dt; Color frag(Color col, Texture tex, Vertex v) { - vec4 c = texel(tex, v.uv) * col; - c.gb *= sin(dt); - return c; + return col * texel(tex, v.uv); } #END_FRAGMENT_SHADER diff --git a/bin/font2.png b/bin/font2.png Binary files differnew file mode 100644 index 0000000..6c9a375 --- /dev/null +++ b/bin/font2.png diff --git a/bin/jin.exe b/bin/jin.exe Binary files differindex a9da499..e30c82c 100644 --- a/bin/jin.exe +++ b/bin/jin.exe diff --git a/bin/main.lua b/bin/main.lua index 2a9ee22..66fd4ba 100644 --- a/bin/main.lua +++ b/bin/main.lua @@ -1,59 +1,26 @@ io.stdout:setvbuf("no") -local shader -local img -local img2 -local canvas -local sw, sh = jin.graphics.getSize() -local page -local font +local shader +local text +local page +local tf function jin.core.onLoad() - local str = jin.filesystem.read("metaball.shader") - shader = jin.graphics.newShader(str) - local w, h = 256, 240 - local bitmap = jin.graphics.newBitmap(w, h, {255, 0, 255, 255}) - local b = bitmap:clone() - bitmap = nil - local bitmap2 = jin.graphics.newBitmap("img2.bmp") - img2 = jin.graphics.newTexture(b) - img = jin.graphics.newTexture(bitmap2) - canvas = jin.graphics.newCanvas(200, 100) - - local fontdata = jin.graphics.newFontData("font.ttf") - font = fontdata:newFont(15) - local str = jin.filesystem.read("text.txt") - page = font:typeset(str, 17, 0) - fontdata = nil + local font_shader = jin.filesystem.read("font.shader") + shader = jin.graphics.newShader(font_shader) + local bitmap = jin.graphics.newBitmap("font2.png") + local tfdata = jin.graphics.newTTFData("font.ttf") + tf = tfdata:newTTF(15) + page = tf:typeset("this is a test", 16) end --- extern vec3 iResolution; --- extern number iGlobalTime; --- extern vec4 iMouse; -local mx, my = 0, 0 + function jin.core.onEvent(e) if e.type == "Quit" then jin.core.stop() end - if e.type == "KeyDown" then - if e.key == "Escape" then - jin.core.stop() - end - end - if e.type == "MouseMotion" then - -- if e.button == "left" then - mx = e.x - my = e.y - -- end - end end -local dt = 0 function jin.core.onDraw() - dt = dt + 0.1 - --jin.graphics.useShader(shader) - -- jin.graphics.unuseShader() jin.graphics.useShader(shader) - shader:sendNumber("dt", dt) - --jin.graphics.draw(canvas, 0, 0, 2, 2) - font:print(page, 0, 0) - -- jin.graphics.unuseShader() + jin.graphics.print("this is a test", tf, 10, 10, 16) + jin.graphics.unuseShader() end
\ No newline at end of file |