Adventure at Umalu  22nd March, 2013
Rogue-like Dungeon Crawler, written in Java
 All Classes Functions Variables Pages
Public Member Functions | Protected Member Functions | List of all members
jade.ui.Terminal Class Referenceabstract
Inheritance diagram for jade.ui.Terminal:
jade.ui.TermPanel jade.ui.TiledTermPanel

Public Member Functions

 Terminal ()
 
abstract void refreshScreen ()
 
abstract char getKey () throws InterruptedException
 
void bufferChar (Coordinate coord, ColoredChar ch)
 
final void bufferChar (int x, int y, ColoredChar ch)
 
ColoredChar charAt (Coordinate coord)
 
final ColoredChar charAt (int x, int y)
 
final void bufferString (int x, int y, String str, Color color)
 
final void bufferString (Coordinate coord, String str, Color color)
 
final void bufferString (int x, int y, String str)
 
final void bufferString (Coordinate coord, String str)
 
void clearBuffer ()
 
void saveBuffer ()
 
void recallBuffer ()
 
void registerCamera (Camera camera, Coordinate screenCenter)
 
final void registerCamera (Camera camera, int screenCenterX, int screenCenterY)
 
Coordinate cameraCenter (Camera camera)
 
boolean cameraRegistered (Camera camera)
 
void unregisterCamera (Camera camera)
 
void bufferCamera (Camera camera)
 
final void bufferCameras ()
 

Protected Member Functions

final Map< Coordinate,
ColoredChar
getBuffer ()
 

Detailed Description

A terminal used for text mode IO. Features a screen buffer with save and recall, the ability to draw camera views on screen, and keyboard input.

Constructor & Destructor Documentation

jade.ui.Terminal.Terminal ( )

Constructs a new

with empty buffers.

Member Function Documentation

void jade.ui.Terminal.bufferCamera ( Camera  camera)

Buffers the view field of the camera at its registered screen center. For each location in the view field, the tile on

World

of the

Camera

is buffered relative to the registered screen center. The view field will be buffered regardless of the size on screen, so care should be taken with the way the view field is calculated if a certain size on screen is needed.

Parameters
camerathe
Camera
whose fiew view is being buffered
final void jade.ui.Terminal.bufferCameras ( )

Calls

for every

Camera

registered with the

.

void jade.ui.Terminal.bufferChar ( Coordinate  coord,
ColoredChar  ch 
)

Places a character into the buffer at the specified coordinates.

Parameters
coordthe location of the character in the buffer
chthe character being buffered
final void jade.ui.Terminal.bufferChar ( int  x,
int  y,
ColoredChar  ch 
)

Places a character into the buffer at the specified coordinates.

Parameters
xthe x value of the location of the character in the buffer
ythe y value of the location of the character in the buffer
chthe character being buffered
final void jade.ui.Terminal.bufferString ( int  x,
int  y,
String  str,
Color  color 
)

Buffers a

String

at (x, y) on the screen with the given

Color
Parameters
xthe x value of the location of the first character of str
ythe y value of the location of the first character of str
strthe
String
being buffered
colorthe
Color
of the
String
being buffered
final void jade.ui.Terminal.bufferString ( Coordinate  coord,
String  str,
Color  color 
)

Buffers a

String

at location on the screen with the given

Color
Parameters
coordthe location of the first character of str
strthe
String
being buffered
colorthe
Color
of the
String
being buffered
final void jade.ui.Terminal.bufferString ( int  x,
int  y,
String  str 
)

Buffers a

String

at (x, y) on the screen with a default

Color

of white.

Parameters
xthe x value of the location of the first character of str
ythe y value of the location of the first character of str
strthe
String
being buffered
final void jade.ui.Terminal.bufferString ( Coordinate  coord,
String  str 
)

Buffers a

String

at location on the screen with a default

Color

of white.

Parameters
coordthe location of the first character of str
strthe
String
being buffered
Coordinate jade.ui.Terminal.cameraCenter ( Camera  camera)

Returns the registered screen center for the provided

Camera
Parameters
camerathe
Camera
whose screen center is being queried
Returns
the registered screen center for the provided
Camera
boolean jade.ui.Terminal.cameraRegistered ( Camera  camera)

Returns true if the

Camera

is registered.

Parameters
camerathe
Camera
being queried
Returns
true if the
Camera
is registered.
ColoredChar jade.ui.Terminal.charAt ( Coordinate  coord)

Returns the character at the specified coordinates. Null is returned if nothing is in the buffer.

Parameters
coordthe location in the buffer being queried
Returns
the character at the specified coordinates
final ColoredChar jade.ui.Terminal.charAt ( int  x,
int  y 
)

Returns the character at the specified coordinates. Null is returned if nothing is in the buffer.

Parameters
xthe x value of location in the buffer being queried
ythe y value of location in the buffer being queried
Returns
the character at the specified coordinates
void jade.ui.Terminal.clearBuffer ( )

Clears all contents of the buffer.

abstract char jade.ui.Terminal.getKey ( ) throws InterruptedException
pure virtual

Returns the next key press as a

char

. This method block until a key press is available.

Returns
the next key press
Exceptions
InterruptedException

Implemented in jade.ui.TermPanel.

void jade.ui.Terminal.recallBuffer ( )

Returns the buffer to the last saved state. A saved state can be made by calling

.

abstract void jade.ui.Terminal.refreshScreen ( )
pure virtual

Refreshes the screen to reflect the current state of the buffer. Until this method is called, no changes to the buffer should be displayed.

Exceptions
InterruptedException

Implemented in jade.ui.TermPanel, and jade.ui.TiledTermPanel.

void jade.ui.Terminal.registerCamera ( Camera  camera,
Coordinate  screenCenter 
)

Registers a

Camera

so that when

is called its view field is drawn at the provided screen center.

Parameters
camerathe
Camera
being registered
screenCenterthe location on screen where the
Camera
center will be drawn
final void jade.ui.Terminal.registerCamera ( Camera  camera,
int  screenCenterX,
int  screenCenterY 
)

Registers a

Camera

so that when

is called its view field is drawn at the provided screen center.

Parameters
camerathe
Camera
being registered
screenCenterXthe x value of the location on screen where the
Camera
center will be drawn
screenCenterYthe y value of the location on screen where the
Camera
center will be drawn
void jade.ui.Terminal.saveBuffer ( )

Saves the current state of the buffer. The buffer can be reverted to this state by calling

.

void jade.ui.Terminal.unregisterCamera ( Camera  camera)

Unregisters the

Camera

so that it cannot be drawn on screen.

Parameters
camerathe
Camera
being unregistered

The documentation for this class was generated from the following file: