newEditorState :: Resources -> IO EditorState
newEditorState resources = do
  let tileset = rsrcTileset resources
  let offTile = tilesetGet OffTile tileset
  let nullTile = tilesetGet NullTile tileset
  let tmap = makeEmptyTerrainMap (55, 44) offTile nullTile
  minimap <- newMinimapFromTerrainMap tmap
  return EditorState
    { esBrush = nullTile,
      esCameraTopleft = pZero,
      esClock = initClock,
      esFilename = "",
      esMinimap = minimap,
      esNullTile = nullTile,
      esPaletteTop = 0,
      esRedoStack = [],
      esTerrain = tmap,
      esTileArray = tilesetArray tileset, -- TODO remove this field
      esTileset = tileset,
      esUndoStack = [],
      esUnsaved = False }

-------------------------------------------------------------------------------
newEditorState :: Resources -> IO EditorState
newEditorState resources = do
  let tileset = rsrcTileset resources
  let offTile = tilesetGet OffTile tileset
  let nullTile = tilesetGet NullTile tileset
  let tmap = makeEmptyTerrainMap (55, 44) offTile nullTile
  minimap <- newMinimapFromTerrainMap tmap
  return EditorState
    { esBrush = nullTile,
      esCameraTopleft = pZero,
      esClock = initClock,
      esFilename = "",
      esMinimap = minimap,
      esNullTile = nullTile,
      esPaletteTop = 0,
      esRedoStack = [],
      esTerrain = tmap,
      esTileArray = tilesetArray tileset, -- TODO remove this field
      esTileset = tileset,
      esUndoStack = [],
      esUnsaved = False }

-------------------------------------------------------------------------------
newEditorState resources = do
  let tileset = rsrcTileset resources
  let offTile = tilesetGet OffTile tileset
  let nullTile = tilesetGet NullTile tileset
  let tmap = makeEmptyTerrainMap (55, 44) offTile nullTile
  minimap <- newMinimapFromTerrainMap tmap
  return EditorState
    { esBrush = nullTile,
      esCameraTopleft = pZero,
      esClock = initClock,
      esFilename = "",
      esMinimap = minimap,
      esNullTile = nullTile,
      esPaletteTop = 0,
      esRedoStack = [],
      esTerrain = tmap,
      esTileArray = tilesetArray tileset, -- TODO remove this field
      esTileset = tileset,
      esUndoStack = [],
      esUnsaved = False }

-------------------------------------------------------------------------------