Haxe 3.0 Compatibility changes

Improved changes to make haxepunk compile with haxe 3.0.
I think that should be merged on haxe 3.0 branch, but I merged that branch with upstream master.