This demo implements a simple tilemap editor.
Use Arrows or WASD to move camera, Left Mouse Button to set tile, Right Mouse Button to delete tiles, and 1-4 to select tiles layer.
Press Space to toggle viewport test (will render on smaller region).
The following shows the full code for this tilemap editor demo.