Class Index | File Index

Classes


Class ROT.Display

Visual map display
Defined in: <rot.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
ROT.Display(options)
Method Summary
Method Attributes Method Name and Description
 
Clear the whole display (cover it with background color)
 
computeFontSize(availWidth, availHeight)
Compute the maximum font size to fit into a set of given constraints
 
computeSize(availWidth, availHeight)
Compute the maximum width/height to fit into a set of given constraints
 
DEBUG(x, y, what)
Debug helper, ideal as a map generator callback.
 
draw(x, y, ch, fg, bg)
 
drawText(x, y, text, maxWidth)
Draws a text at given position.
 
Returns the DOM node of this display
 
Returns currently set options
 
setOptions(options)
Class Detail
ROT.Display(options)
Parameters:
{object} options Optional
{int} options.width Optional, Default: ROT.DEFAULT_WIDTH
{int} options.height Optional, Default: ROT.DEFAULT_HEIGHT
{int} options.fontSize Optional, Default: 15
{string} options.fontFamily Optional, Default: "monospace"
{string} options.fontStyle Optional, Default: ""
bold/italic/none/both
{string} options.fg Optional, Default: "#ccc"
{string} options.bg Optional, Default: "#000"
{int} options.fps Optional, Default: 25
{float} options.spacing Optional, Default: 1
{float} options.border Optional, Default: 0
{string} options.layout Optional, Default: "rect"
Method Detail
clear()
Clear the whole display (cover it with background color)

{int} computeFontSize(availWidth, availHeight)
Compute the maximum font size to fit into a set of given constraints
Parameters:
{int} availWidth
Maximum allowed pixel width
{int} availHeight
Maximum allowed pixel height
Returns:
{int} fontSize

{int[2]} computeSize(availWidth, availHeight)
Compute the maximum width/height to fit into a set of given constraints
Parameters:
{int} availWidth
Maximum allowed pixel width
{int} availHeight
Maximum allowed pixel height
Returns:
{int[2]} cellWidth,cellHeight

DEBUG(x, y, what)
Debug helper, ideal as a map generator callback. Always bound to this.
Parameters:
{int} x
{int} y
{int} what

draw(x, y, ch, fg, bg)
Parameters:
{int} x
{int} y
{string} ch
{string} fg Optional
foreground color
{string} bg Optional
background color

{int} drawText(x, y, text, maxWidth)
Draws a text at given position. Optionally wraps at a maximum length. Currently does not work with hex layout.
Parameters:
{int} x
{int} y
{string} text
May contain color/background format specifiers, %c{name}/%b{name}, both optional. %c{}/%b{} resets to default.
{int} maxWidth Optional
wrap at what width?
Returns:
{int} lines drawn

{node} getContainer()
Returns the DOM node of this display
Returns:
{node} DOM node

{object} getOptions()
Returns currently set options
Returns:
{object} Current options object

setOptions(options)
Parameters:
options
See:
ROT.Display

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Mar 08 2013 11:07:30 GMT+0100 (CET)