2023-09-04 18:56:14 +00:00
|
|
|
local lg = assert( love.graphics )
|
|
|
|
local scene = assert( require 'client.scene' )
|
|
|
|
local socket = assert( require 'socket' )
|
|
|
|
local shared = assert( require 'shared' )
|
|
|
|
local udp = socket.udp()
|
|
|
|
|
|
|
|
local game = {}
|
|
|
|
local t = 0
|
|
|
|
local tick = 0
|
|
|
|
|
|
|
|
local currentWorld = shared.NewWorld()
|
|
|
|
|
|
|
|
function game.draw()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function game.update( dt )
|
|
|
|
t = dt + t
|
|
|
|
if t > 0.1 then
|
|
|
|
t = 0
|
|
|
|
tick = tick + 1
|
|
|
|
local s = string.format("client: %d", tick)
|
|
|
|
print( s )
|
|
|
|
udp:send( s )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function game.onLoad( )
|
|
|
|
udp:settimeout( 0 )
|
|
|
|
udp:setpeername( "192.168.2.15", 51312 )
|
|
|
|
end
|
|
|
|
|
|
|
|
return scene.add( game, 'game' )
|