Skip to content

Commit

Permalink
Fixed #18: Convert between TE and RTE
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Nov 14, 2023
1 parent aeef40f commit 438f69b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 438f69b

Please sign in to comment.