gamelost/glc-client — pull request #71 by captdeaf (2014-06-11 07:42:19+00:00)
Title: Massive restructuring of main.lua under way

This is the start of refactoring main.lua and a few other files.

e.g:

* love.* events are now handled by library/loveevents.lua, which lets anything make callbacks. local events = require('library/lovevents')

* events.addHandler('update', cb), etc.

* As a result, interestingly, a bit of reordering is needed in main.lua. Where previously, function love.draw() could reference something farther down the file, now it oddly requires things to be defined prior to being called.

* events.callIn(secs, cb) for one-time calls (demo'd by splash screen)

* events.callEvery(secs, cb) for repeated, frequent calls (demo'd by player's sending updates)

* As part of the breakup, I split drawText and drawPlayer into library/mapdrawing.lua, adding mapdrawing.drawText(...) and mapdrawing.drawImageQuad(...)

This is the _start_, hopefully, of breaking pieces apart into logically separated files. So far, this just breaks out player-handling and map drawing, but lots more to do: zones, console, keybinding and handlers, etc.