GameView

scalata.application.services.GameView
trait GameView[F[_], I]

Abstract UI bridge.

The trait is effect-polymorphic: every action yields a value in the effect F[_] (e.g. IO).

Type parameters

F

effect type constructor (cats.effect.IO, etc.)

I

raw input representation (e.g. String, scan-coded key, structured AST)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ConsoleView[F]
class JLineView[F]

Members list

Value members

Abstract 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.

Value parameters

text

content to render; A’s toString is used if no specific formatting is applied.

Attributes

def displayError[A](message: 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[I]

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