Module ROT.Display

Visual Display.

A Code Page 437 terminal emulator based on AsciiPanel.

Functions

init ([w=80[, h=24[, scale=1[, dfg[, dbg[, fullOrFlags=false[, vsync=false[, fsaa=0]]]]]]]]) Constructor.
draw () Draw.
contains (x, y) Contains point.
getCharacter (x, y) Get a character.
getBackgroundColor (x, y) Get a background color.
getForegroundColor (x, y) Get a foreground color.
setDefaultBackgroundColor (c) Set Default Background Color.
setDefaultForegroundColor (c) Set Defaul Foreground Color.
clear ([c=' '[, x=1[, y=1[, w[, h[, fg[, bg]]]]]]]) Clear the screen.
clearCanvas () Clear canvas.
write (s[, x=1[, y=1[, fg[, bg]]]]) Write.
writeCenter (s[, y=1[, fg[, bg]]]) Write Center.
drawText (x, y, text, maxWidth) Draw text.


Functions

init ([w=80[, h=24[, scale=1[, dfg[, dbg[, fullOrFlags=false[, vsync=false[, fsaa=0]]]]]]]])
Constructor. The display constructor. Called when ROT.Display:new() is called.

Parameters:

  • w int Width of display in number of characters (default 80)
  • h int Height of display in number of characters (default 24)
  • scale float Window scale modifier applied to glyph dimensions (default 1)
  • dfg table Default foreground color as a table defined as {r,g,b,a} (optional)
  • dbg table Default background color (optional)
  • fullOrFlags boolean In Love 0.8.0: Use fullscreen In Love 0.9.0: a table defined for love.graphics.setMode (default false)
  • vsync boolean Use vsync (default false)
  • fsaa int Number of fsaa passes (default 0)

Returns:

    nil
draw ()
Draw. The main draw function. This should be called from love.draw() to display any written characters to screen
contains (x, y)
Contains point. Returns true if point x,y can be drawn to display.

Parameters:

  • x
  • y
getCharacter (x, y)
Get a character. returns the character being displayed at position x, y

Parameters:

  • x int The x-position of the character
  • y int The y-position of the character

Returns:

    string The character
getBackgroundColor (x, y)
Get a background color. returns the current background color of the character written to position x, y

Parameters:

  • x int The x-position of the character
  • y int The y-position of the character

Returns:

    table The background color as a table defined as {r,g,b,a}
getForegroundColor (x, y)
Get a foreground color. returns the current foreground color of the character written to position x, y

Parameters:

  • x int The x-position of the character
  • y int The y-position of the character

Returns:

    table The foreground color as a table defined as {r,g,b,a}
setDefaultBackgroundColor (c)
Set Default Background Color. Sets the background color to be used when it is not provided

Parameters:

  • c table The background color as a table defined as {r,g,b,a}
setDefaultForegroundColor (c)
Set Defaul Foreground Color. Sets the foreground color to be used when it is not provided

Parameters:

  • c table The foreground color as a table defined as {r,g,b,a}
clear ([c=' '[, x=1[, y=1[, w[, h[, fg[, bg]]]]]]])
Clear the screen. By default wipes the screen to the default background color. You can provide a character, x-position, y-position, width, height, fore-color and back-color and write the same character to a portion of the screen

Parameters:

  • c string A character to write to the screen - may fail for strings with a length > 1 (default ' ')
  • x int The x-position from which to begin the wipe (default 1)
  • y int The y-position from which to begin the wipe (default 1)
  • w int The number of chars to wipe in the x direction (optional)
  • h int Then number of chars to wipe in the y direction (optional)
  • fg table The color used to write the provided character (optional)
  • bg table the color used to fill in the background of the cleared space (optional)
clearCanvas ()
Clear canvas. runs the clear method of the Love2D canvas object being used to write to the screen
write (s[, x=1[, y=1[, fg[, bg]]]])
Write. Writes a string to the screen

Parameters:

  • s string The string to be written
  • x int The x-position where the string will be written (default 1)
  • y int The y-position where the string will be written (default 1)
  • fg table The color used to write the provided string (optional)
  • bg table the color used to fill in the string's background (optional)
writeCenter (s[, y=1[, fg[, bg]]])
Write Center. write a string centered on the middle of the screen

Parameters:

  • s string The string to be written
  • y int The y-position where the string will be written (default 1)
  • fg table The color used to write the provided string (optional)
  • bg table the color used to fill in the string's background (optional)
drawText (x, y, text, maxWidth)
Draw text. Draws a text at given position. Optionally wraps at a maximum length.

Parameters:

  • x number
  • y number
  • text string May contain color/background format specifiers, %c{name}/%b{name}, both optional. %c{}/%b{} resets to default.
  • maxWidth number wrap at what width (optional)?

Returns:

    number lines drawn
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03