buildat/share/client/init.lua

39 lines
799 B
Lua
Raw Normal View History

2014-09-18 21:54:29 +03:00
-- Buildat: client/init.lua
buildat = {}
function buildat:Logger(module)
local logger = {}
function logger:info(text)
print(os.date("%b %d %H:%M:%S "..module..": "..text))
end
return logger
end
local log = buildat:Logger("__client")
log:info("init.lua loaded")
require "Polycode/Core"
scene = Scene(Scene.SCENE_2D)
scene:getActiveCamera():setOrthoSize(640, 480)
label = SceneLabel("Hello from Lua!", 32)
label:setPosition(-50, -50, 0)
scene:addChild(label)
2014-09-19 01:42:52 +03:00
buildat.packet_subs = {}
2014-09-18 21:54:29 +03:00
function buildat:sub_packet(name, cb)
2014-09-19 01:42:52 +03:00
buildat.packet_subs[name] = cb
2014-09-18 21:54:29 +03:00
end
function buildat:unsub_packet(cb)
2014-09-19 01:42:52 +03:00
for name, cb1 in pairs(buildat.packet_subs) do
if cb1 == cb then
buildat.packet_subs[cb] = nil
end
end
end
function buildat:send_packet(name, data)
__buildat_send_packet(name, data)
2014-09-18 21:54:29 +03:00
end