aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/client/config.lua8
-rw-r--r--bin/client/main.lua49
-rw-r--r--bin/jin.exebin807424 -> 1662976 bytes
-rw-r--r--bin/main.lua2
4 files changed, 58 insertions, 1 deletions
diff --git a/bin/client/config.lua b/bin/client/config.lua
new file mode 100644
index 0000000..3e696b8
--- /dev/null
+++ b/bin/client/config.lua
@@ -0,0 +1,8 @@
+return
+{
+ width = 512,
+ height = 400,
+ fullscreen = false,
+ resizable = true,
+ title = "Jin Modules"
+}
diff --git a/bin/client/main.lua b/bin/client/main.lua
new file mode 100644
index 0000000..df33e21
--- /dev/null
+++ b/bin/client/main.lua
@@ -0,0 +1,49 @@
+io.stdout:setvbuf("no")
+local thread = nil
+local socket = nil
+local asynReceive = [[
+io.stdout:setvbuf("no")
+local thread = jin.thread.getThread()
+local socket = thread:demand(1)
+while true do
+ -- local sendBuf = thread:demand(3)
+ -- socket:send(sendBuf)
+ local buf = socket:receive()
+ thread:send(2, buf)
+end
+]]
+local x = 30
+local y = 30
+jin.core.onLoad = function()
+ thread = jin.thread.Thread("asynReceive", asynReceive)
+ jin.net.init()
+ socket = jin.net.Socket("TCP", "127.0.0.1", 8809)
+ thread:start()
+ thread:send(1, socket)
+end
+
+jin.core.onEvent = function(e)
+ if e.type == "quit" then
+ jin.core.stop() elseif e.type == "keydown" then
+ if e.key == "Escape" then
+ jin.core.stop()
+ end
+ end
+end
+local i = 0
+jin.core.onUpdate = function(dt)
+ if thread:receive(2) then
+ local buf = thread:fetch(2)
+ x, xl = buf:grabFloat(0)
+ y, yl = buf:grabFloat(xl)
+ end
+
+ -- local buf = jin.net.Buffer(0)
+ -- buf:append(x)
+ -- buf:append(y)
+ -- thread:send(3, buf)
+end
+
+jin.core.onDraw = function()
+ jin.graphics.circle("fill", x, y, 12)
+end \ No newline at end of file
diff --git a/bin/jin.exe b/bin/jin.exe
index a59b492..a2db2ab 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ
diff --git a/bin/main.lua b/bin/main.lua
index 3480016..b7f7124 100644
--- a/bin/main.lua
+++ b/bin/main.lua
@@ -1,3 +1,3 @@
-require "jin-modules.main"
+require "client.main"