aboutsummaryrefslogtreecommitdiff
path: root/bin/client
diff options
context:
space:
mode:
Diffstat (limited to 'bin/client')
-rw-r--r--bin/client/main.lua28
1 files changed, 11 insertions, 17 deletions
diff --git a/bin/client/main.lua b/bin/client/main.lua
index 5d10e6a..9c176f8 100644
--- a/bin/client/main.lua
+++ b/bin/client/main.lua
@@ -11,14 +11,13 @@ while true do
thread:send(2, buf)
end
]]
-
jin.core.onLoad = function()
- -- jin.net.init()
- -- socket = jin.net.Socket("TCP", "127.0.0.1", 8809)
+ jin.net.init()
+ socket = jin.net.Socket("TCP", "127.0.0.1", 8803)
- -- thread = jin.thread.Thread("asynReceive", asynReceive)
- -- thread:start()
- -- thread:send(1, socket)
+ thread = jin.thread.Thread("asynReceive", asynReceive)
+ thread:start()
+ thread:send(1, socket)
end
jin.core.onEvent = function(e)
@@ -32,18 +31,13 @@ end
local x = 0
local y = 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)
+ if thread:receive(2) then
+ local buf = thread:fetch(2)
+ x, xl = buf:grabFloat(0)
+ y, yl = buf:grabFloat(xl)
+ end
end
jin.core.onDraw = function()
jin.graphics.circle("fill", x, y, 12)
-end \ No newline at end of file
+end