Added support for Terminal.up(), down(), left(), right() for the terminal.

This commit is contained in:
Adam Murdoch
2012-08-04 16:18:30 +10:00
parent 7ee843612a
commit ec9d8d7bf8
12 changed files with 686 additions and 467 deletions

View File

@@ -1,5 +1,10 @@
package net.rubygrapefruit.platform;
/**
* Allows the terminal/console to be manipulated.
*
* Supported on Linux, OS X, Windows.
*/
public interface Terminal {
enum Color {
Black, Red, Green, Yellow, Blue, Magenta, Cyan, White
@@ -7,26 +12,64 @@ public interface Terminal {
/**
* Returns the size of the terminal.
*
* @throws NativeException On failure.
*/
TerminalSize getTerminalSize();
TerminalSize getTerminalSize() throws NativeException;
/**
* Sets the terminal foreground color.
*
* @throws NativeException On failure.
*/
Terminal foreground(Color color);
Terminal foreground(Color color) throws NativeException;
/**
* Switches the terminal to bold mode.
*
* @throws NativeException On failure.
*/
Terminal bold();
Terminal bold() throws NativeException;
/**
* Switches the terminal to normal mode.
*
* @throws NativeException On failure.
*/
Terminal normal();
Terminal normal() throws NativeException;
/**
* Switches the terminal to normal mode and restores default colors.
*
* @throws NativeException On failure.
*/
Terminal reset();
Terminal reset() throws NativeException;
/**
* Moves the cursor the given number of characters to the left.
*
* @throws NativeException On failure.
*/
Terminal cursorLeft(int count) throws NativeException;
/**
* Moves the cursor the given number of characters to the right.
*
* @throws NativeException On failure.
*/
Terminal cursorRight(int count) throws NativeException;
/**
* Moves the cursor the given number of characters up.
*
* @throws NativeException On failure.
*/
Terminal cursorUp(int count) throws NativeException;
/**
* Moves the cursor the given number of characters down.
*
* @throws NativeException On failure.
*/
Terminal cursorDown(int count) throws NativeException;
}