diff --git a/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/RogueTerminalEmulator.scala b/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/RogueTerminalEmulator.scala index 091f2d8c..1194e251 100644 --- a/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/RogueTerminalEmulator.scala +++ b/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/RogueTerminalEmulator.scala @@ -252,6 +252,9 @@ final class RogueTerminalEmulator( def inset(otherConsole: Terminal, offset: Point): RogueTerminalEmulator = put(otherConsole.toPositionedBatch.filterNot(_._2 == Terminal.EmptyTile), offset) + def toTerminalEmulator: TerminalEmulator = + TerminalEmulator(size).inset(this, Point.zero) + object RogueTerminalEmulator: inline def pointToIndex(point: Point, gridWidth: Int): Int = diff --git a/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/TerminalEmulator.scala b/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/TerminalEmulator.scala index ec5ece03..baead178 100644 --- a/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/TerminalEmulator.scala +++ b/roguelike-starterkit/src/main/scala/io/indigoengine/roguelike/starterkit/terminal/TerminalEmulator.scala @@ -90,9 +90,7 @@ final case class TerminalEmulator(size: Size, charMap: QuadTree[MapTile]) extend this.copy(charMap = charMap.removeElement(Vertex.fromPoint(coords))) def clear: TerminalEmulator = - this.copy(charMap = - QuadTree.empty[MapTile](size.width.toDouble, size.height.toDouble) - ) + this.copy(charMap = QuadTree.empty[MapTile](size.width.toDouble, size.height.toDouble)) def optimise: TerminalEmulator = this.copy(charMap = charMap.prune) @@ -222,6 +220,9 @@ final case class TerminalEmulator(size: Size, charMap: QuadTree[MapTile]) extend def inset(otherConsole: Terminal, offset: Point): TerminalEmulator = put(otherConsole.toPositionedBatch, offset) + def toRogueTerminalEmulator: RogueTerminalEmulator = + RogueTerminalEmulator(size).inset(this, Point.zero) + object TerminalEmulator: def apply(screenSize: Size): TerminalEmulator = TerminalEmulator(