Updates to rendering and input

Started work on implementing mouse input properly. Also implemented
re-ordering of sprites within a scene.