refactored into class/module hierarchy

class/module hierarchy will support running various game engines with the
existing frontends.
Added pyglet frontend.