class AsciiPanelView : View
An implementation of terminal view for old-school games. Initially ported from JPanel AsciiPanel https://github.com/trystan/AsciiPanel to Android View
Author
Alexander Roman
class ColoredChar
Object for chars to print on the panel |
|
interface OnCharClickedListener
Interface to be called on panel character click |
AsciiPanelView(context: Context)
Default View constructors by context AsciiPanelView(context: Context, attrs: AttributeSet)
Default View constructors by context and attributes AsciiPanelView(context: Context, attrs: AttributeSet, defStyleAttr: Int)
Default View constructors by context, attributes and default style |
var bgColor: Int
color of char background to be drawn if not specified |
|
var charColor: Int
color of chars to be drawn if not specified |
|
lateinit var chars: Array<Array<ColoredChar>>
matrix of ColoredChar to be drawn on the panel |
|
var cursorX: Int
position X of cursor to draw next char at |
|
var cursorY: Int
position Y of cursor to draw next char at |
|
var fontFamily: String
font file name to use for drawing chars |
|
var onCharClickedListener: OnCharClickedListener?
interface of OnCharClickedListener to be called on panel char click |
|
var panelHeight: Int
height of panel in chars |
|
var panelWidth: Int
width of panel in chars |
fun clear(): AsciiPanelView
Clear the entire screen to whatever the default background color is. fun clear(character: Char): AsciiPanelView
Clear the entire screen with the specified character and whatever the default foreground and background colors are. fun clear(character: Char, charColor: Int, bgColor: Int): AsciiPanelView
Clear the entire screen with the specified character and whatever the specified foreground and background colors are. |
|
fun clearRect(character: Char, x: Int, y: Int, width: Int, height: Int): AsciiPanelView
Clear the section of the screen with the specified character and whatever the default foreground and background colors are. The cursor position will not be modified. fun clearRect(character: Char, x: Int, y: Int, width: Int, height: Int, charColor: Int, bgColor: Int): AsciiPanelView
Clear the section of the screen with the specified character and whatever the specified foreground and background colors are. |
|
fun onDraw(canvas: Canvas): Unit |
|
fun onSizeChanged(xNew: Int, yNew: Int, xOld: Int, yOld: Int): Unit |
|
fun onTouchEvent(event: MotionEvent): Boolean |
|
fun setCursorPosX(cursorX: Int): AsciiPanelView
Sets the distance from the left new text will be written to. |
|
fun setCursorPosY(cursorY: Int): AsciiPanelView
Sets the distance from the top new text will be written to. |
|
fun setCursorPosition(x: Int, y: Int): AsciiPanelView
Sets the x and y position of where new text will be written to. The origin (0,0) is the upper left corner. |
|
fun writeCenter(string: String, y: Int): AsciiPanelView
Write a string to the center of the panel at the specified y position. This updates the cursor's position. fun writeCenter(string: String, y: Int, charColor: Int): AsciiPanelView
Write a string to the center of the panel at the specified y position with the specified foreground color. This updates the cursor's position but not the default foreground color. fun writeCenter(string: String, y: Int, charColor: Int?, bgColor: Int?): AsciiPanelView
Write a string to the center of the panel at the specified y position with the specified foreground and background colors. This updates the cursor's position but not the default foreground or background colors. |
|
fun writeChar(character: Char): AsciiPanelView
Write a character to the cursor's position. This updates the cursor's position. fun writeChar(character: Char, charColor: Int): AsciiPanelView
Write a character to the cursor's position with the specified foreground color. This updates the cursor's position but not the default foreground color. fun writeChar(character: Char, x: Int, y: Int, charColor: Int): AsciiPanelView
Write a character to the specified position with the specified foreground color. This updates the cursor's position but not the default foreground color. fun writeChar(character: Char, x: Int, y: Int, charColor: Int?, bgColor: Int?): AsciiPanelView
Write a character to the specified position with the specified foreground and background colors. This updates the cursor's position but not the default foreground or background colors. |
|
fun writeCharWithColor(character: Char, charColor: Int, bgColor: Int): AsciiPanelView
Write a character to the cursor's position with the specified foreground and background colors. This updates the cursor's position but not the default foreground or background colors. |
|
fun writeCharWithPos(character: Char, x: Int, y: Int): AsciiPanelView
Write a character to the specified position. This updates the cursor's position. |
|
fun writeString(string: String): AsciiPanelView
Write a string to the cursor's position. This updates the cursor's position. fun writeString(string: String, charColor: Int): AsciiPanelView
Write a string to the cursor's position with the specified foreground color. This updates the cursor's position but not the default foreground color. fun writeString(string: String, x: Int, y: Int, charColor: Int): AsciiPanelView
Write a string to the specified position with the specified foreground color. This updates the cursor's position but not the default foreground color. fun writeString(string: String, x: Int, y: Int, charColor: Int?, bgColor: Int?): AsciiPanelView
Write a string to the specified position with the specified foreground and background colors. This updates the cursor's position but not the default foreground or background colors. |
|
fun writeStringWithColor(string: String, charColor: Int, bgColor: Int): AsciiPanelView
Write a string to the cursor's position with the specified foreground and background colors. This updates the cursor's position but not the default foreground or background colors. |
|
fun writeStringWithPos(string: String, x: Int, y: Int): AsciiPanelView
Write a string to the specified position. This updates the cursor's position. |
const val DEFAULT_BG_COLOR: Int
Default char background color = Color.WHITE |
|
const val DEFAULT_CHAR_COLOR: Int
Default char color = Color.BLACK |
|
const val DEFAULT_FONT: String
Default font |
|
const val DEFAULT_PANEL_HEIGHT: Int
Default panel height in chars = 27 |
|
const val DEFAULT_PANEL_WIDTH: Int
Default panel width in chars = 64 |