aboutsummaryrefslogtreecommitdiff
path: root/bin/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/main.lua')
-rw-r--r--bin/main.lua40
1 files changed, 39 insertions, 1 deletions
diff --git a/bin/main.lua b/bin/main.lua
index b7f7124..bd2c011 100644
--- a/bin/main.lua
+++ b/bin/main.lua
@@ -1,3 +1,41 @@
-require "client.main"
+local loadAssets = [[
+local thread = jin.thread.getThread()
+local path = thread:demand(1)
+local img = jin.graphics.Image(path)
+thread:send(2, img)
+while(true) do
+ if(thread:receive(255)) then
+ break; -- quit thread
+ end
+end
+]]
+local img = nil
+local loader = nil
+jin.core.onLoad = function()
+ loader = jin.thread.Thread("load assets", loadAssets)
+ loader:start()
+ loader:send(1, "./icon.png")
+ --img = jin.graphics.Image("./icon.png")
+end
+
+jin.core.onEvent = function(e)
+ if e.type == "quit" then
+ jin.core.stop()
+ end
+end
+
+jin.core.onUpdate = function(dt)
+ if loader:receive(2) and img == nil then
+ img = loader:fetch(2)
+ loader:send(255, 1)
+ loader:remove(2)
+ end
+end
+
+jin.core.onDraw = function()
+ if img ~= nil then
+ jin.graphics.draw(img, 20, 20)
+ end
+end