JLineView

scalata.infrastructure.view.terminal.jline.JLineView
See theJLineView companion object
final class JLineView[F[_]] extends GameView[F, String]

Console implementation of GameView using JLin.

Uses ANSI escape sequences to clear the screen and reads input via JLine library, which is blocking.

Attributes

See also

GameView for method-level semantics

Companion
object
Graph
Supertypes
trait GameView[F, String]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def clearScreen: F[Unit]

Clear the entire screen / viewport.

Clear the entire screen / viewport.

On a terminal implementation this is usually an ANSI escape sequence; on Swing it might reset a text area; on web it may send a “clear” event.

Attributes

def display[A](text: A): F[Unit]

Render text or any printable value.

Render text or any printable value.

Implementations decide where to display: • console (println) • Swing text area • web socket, etc.

Attributes

def displayError[A](msg: A): F[Unit]

Show an error message to the player.

Show an error message to the player.

Recommended to prefix the text with "Error: " or apply red colour, but exact styling is up to the concrete adapter.

Attributes

def getInput: F[String]

Block (or suspend) until the next player command is available.

Block (or suspend) until the next player command is available.

Implementations must: • return an empty/default value if the input source is closed; • guarantee that reads are safe to call repeatedly; • suspend in F rather than performing side effects eagerly.

Attributes