Class:Display
Defined in: adventure/Display.js, line 8
Description
Display creates and manages the game display, including the main input and output areas and the status bar. It also manages custom compasses, verb docks and inventory docks. Authors can customize the display with custom CSS. CSS styles for Display can be found in adventurejs.css. To learn more, see the
Private Constructor:
var foo = new adventurejs.Display(game, displayElId)
Parameters:
-
gameGame
A reference to the game instance. -
displayElIddisplayElId | HTMLElement
An ID for an HTML element to use as a display.
- Index
- Methods
- Properties
Methods Collapse all |
clearInput
clearInput()
Defined in: adventure/display/clearInput.js, line 8
clearOutput
clearOutput()
Defined in: adventure/display/clearOutput.js, line 8
createCompass
createCompass(properties) → {Element}
Defined in: adventure/display/createCompass.js, line 8
Parameters:
-
propertiesObject
HTML ID and CSS classes.
MyGame.createCompass({
"id":"MyCompass",
"cssclasses":["custom"]
});
For more information, see
GUI Compasses.
Returns:
Element
Returns the HTML element of the compass.
createDock
createDock(properties) → {Element}
Defined in: adventure/display/createDock.js, line 8
Parameters:
-
propertiesObject
HTML ID, CSS classes, and verbs.
MyGame.createDock({
"id":"MyRoomDock",
"cssclasses":["custom"],
});
For more information, see
GUI Docks.
Returns:
Element
Returns the HTML element of the verb dock.
initialize
initialize(props) → {adventurejs.Display}
Defined in: adventure/display/initialize.js, line 7
Parameters:
-
propsObject
A generic object containing properties to copy to the DisplayObject instance.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
print
print(msg, classes)
Defined in: adventure/display/print.js, line 8
Todos: add ability to pause at screen height so excess text doesn't scroll off screen
Parameters:
-
msgString
An arbitrary string. -
classesString
Optional class(es) to apply to output.
printInput
printInput(input)
Defined in: adventure/display/printInput.js, line 8
Parameters:
-
inputString
An arbitrary string.
printWithInput
printWithInput(msg, classes)
Defined in: adventure/display/printWithInput.js, line 8
Parameters:
-
msgString
An arbitrary string. -
classesString
Optional class(es) to apply to output.
sendToInput
sendToInput()
Defined in: adventure/display/sendToInput.js, line 8
set
set(props) → {adventurejs.Display}
Defined in: adventure/display/set.js, line 7
Parameters:
-
propsObject
A generic object containing properties to copy to the DisplayObject instance.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
unsetCompasses
unsetCompasses()
Defined in: adventure/display/unsetCompasses.js, line 8
unsetDock
unsetDock(properties)
unsetDocks
unsetDocks(properties)
update
update() → {adventurejs.Display}
Defined in: adventure/display/update.js, line 8
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
updateCompasses
updateCompasses(exits)
Defined in: adventure/display/updateCompasses.js, line 8
Parameters:
-
exitsString
updateContentDocks
updateContentDocks(properties)
Defined in: adventure/display/updateContentDocks.js, line 8
Parameters:
-
propertiesObject
updateExitDocks
updateExitDocks(properties)
Defined in: adventure/display/updateExitDocks.js, line 8
Parameters:
-
propertiesObject
updateInventoryDocks
updateInventoryDocks(properties)
Defined in: adventure/display/updateInventoryDocks.js, line 8
Todos: different lists for specific docks
Parameters:
-
propertiesObject
updateRoom
updateRoom() → {adventurejs.Display}
Defined in: adventure/display/updateRoom.js, line 8
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
updateRoomDocks
updateRoomDocks(properties)
Defined in: adventure/display/updateRoomDocks.js, line 8
Parameters:
-
propertiesObject
updateRoomImage
updateRoomImage(id) → {adventurejs.Display}
Defined in: adventure/display/updateRoomImage.js, line 8
Parameters:
-
idString
The id of an image in game.image_lookup.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
updateScore
updateScore(score) → {adventurejs.Display}
Defined in: adventure/display/updateScore.js, line 8
Parameters:
-
scoreString
Update the score in the status bar.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
Properties |
author
author :String
compasses
compasses :compasses
Defined in: adventure/Display.js, line 42
Default value: []
contentdocks
contentdocks :contentdocks
Defined in: adventure/Display.js, line 67
Default value: []
displayEl
displayEl :HTMLElement
Defined in: adventure/Display.js, line 107
Default value: null
displayElId
displayElId :HTMLElement
Defined in: adventure/Display.js, line 114
Default value: null
docks
docks :docks
Defined in: adventure/Display.js, line 99
Default value: []
exitdocks
exitdocks :exitdocks
Defined in: adventure/Display.js, line 75
Default value: []
game
game :Object
Defined in: adventure/Display.js, line 35
Default value: {}
imagedocks
imagedocks :imagedocks
Defined in: adventure/Display.js, line 91
Default value: []
inventorydocks
inventorydocks :inventorydocks
Defined in: adventure/Display.js, line 83
Default value: []
room
room :String
roomdocks
roomdocks :roomdocks
Defined in: adventure/Display.js, line 59
Default value: []
score
score :String
title
title :String
verbdocks
verbdocks :verbdocks
Defined in: adventure/Display.js, line 51
Default value: []
version