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 widgets and inventory widgets. 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, containerId)
Parameters:
-
gameGame
A reference to the game instance. -
containerIdcontainerId | HTMLElement
An ID for an HTML element to build the game to.
- Index
- Methods
- Properties
Index
Methods:
- appendClassesToLastInput
- appendClassesToLastOutput
- clearInput
- clearOutput
- createCompass
- createMessageWidget
- createVerbList
- createWidget
- hideStatusbar
- hideTitlebar
- initialize
- printInput
- printWithInput
- sendToInput
- set
- showStatusbar
- showTitlebar
- unsetCompasses
- unsetWidget
- unsetWidgets
- update
- updateCompasses
- updateInventoryListWidgets
- updateObjectDescriptionWidgets
- updateObjectListWidgets
- updateRoom
- updateRoomDescriptionWidgets
- updateRoomExitsWidgets
- updateRoomImageWidgets
- updateScore
Properties:
Methods Collapse all |
appendClassesToLastInput
appendClassesToLastInput(classes)
Defined in: Adventure/Display.js, line 221
Parameters:
-
classesString
appendClassesToLastOutput
appendClassesToLastOutput(classes)
Defined in: Adventure/Display.js, line 233
Parameters:
-
classesString
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
Compass Widgets.
Returns:
Element
Returns the HTML element of the compass.
createMessageWidget
createMessageWidget(properties) → {Element}
Defined in: Adventure/Display/createMessageWidget.js, line 8
Parameters:
-
propertiesObject
HTML ID and CSS classes.
Returns:
Element
Returns the HTML element of the compass.
createVerbList
createVerbList(properties) → {Element}
Defined in: Adventure/Display/createVerbList.js, line 8
Parameters:
-
propertiesObject
HTML ID and CSS classes.
Returns:
Element
Returns the HTML element of the compass.
createWidget
createWidget(properties) → {Element}
Defined in: Adventure/Display/createWidget.js, line 8
Parameters:
-
propertiesObject
HTML ID, CSS classes, and verbs.
MyGame.createWidget({
"id":"MyRoomWidget",
"cssclasses":["custom"],
});
Returns:
Element
Returns the HTML element of the verb widget.
hideStatusbar
hideStatusbar() → {boolean}
hideTitlebar
hideTitlebar() → {boolean}
initialize
initialize(props) → {Object}
Defined in: Adventure/Display/initialize.js, line 7
Parameters:
-
propsString | Object
A container element into which to build the display.
Returns:
Object
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.)
showStatusbar
showStatusbar() → {boolean}
showTitlebar
showTitlebar() → {boolean}
unsetCompasses
unsetCompasses()
Defined in: Adventure/Display/unsetCompasses.js, line 8
unsetWidget
unsetWidget(properties)
Defined in: Adventure/Display/unsetWidget.js, line 8
Parameters:
-
propertiesObject
unsetWidgets
unsetWidgets(properties)
update
update() → {Object}
Defined in: Adventure/Display/update.js, line 8
Returns:
Object
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
updateInventoryListWidgets
updateInventoryListWidgets(inventory)
Defined in: Adventure/Display/updateInventoryListWidgets.js, line 8
Todos: different lists for specific widgets
Parameters:
-
inventoryObject
updateObjectDescriptionWidgets
updateObjectDescriptionWidgets(output, asset)
Defined in: Adventure/Display/updateObjectDescriptionWidgets.js, line 8
Todos: handle images
Parameters:
-
outputString -
assetObject
updateObjectListWidgets
updateObjectListWidgets(properties)
Defined in: Adventure/Display/updateObjectListWidgets.js, line 8
Parameters:
-
propertiesObject
updateRoom
updateRoom() → {Object}
Defined in: Adventure/Display/updateRoom.js, line 8
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
updateRoomDescriptionWidgets
updateRoomDescriptionWidgets(properties)
Defined in: Adventure/Display/updateRoomDescriptionWidgets.js, line 8
Parameters:
-
propertiesObject
updateRoomExitsWidgets
updateRoomExitsWidgets(properties)
Defined in: Adventure/Display/updateRoomExitsWidgets.js, line 8
Parameters:
-
propertiesObject
updateRoomImageWidgets
updateRoomImageWidgets(image) → {Object}
Defined in: Adventure/Display/updateRoomImageWidgets.js, line 8
Parameters:
-
imageString
The id of an image in game.image_lookup.
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
updateScore
updateScore(score) → {Object}
Defined in: Adventure/Display/updateScore.js, line 8
Parameters:
-
scoreString
Update the score in the status bar.
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
Properties |
author
author :String
compass_widgets
compass_widgets :compass_widgets
Defined in: Adventure/Display.js, line 51
Default value: []
compasses
compasses :compasses
Defined in: Adventure/Display.js, line 42
Default value: []
containerId
containerId :HTMLElement
Defined in: Adventure/Display.js, line 138
Default value: null
displayEl
displayEl :HTMLElement
Defined in: Adventure/Display.js, line 131
Default value: null
game
game :Object
Defined in: Adventure/Display.js, line 35
Default value: {}
inventory_list_widgets
inventory_list_widgets :inventory_list_widgets
Defined in: Adventure/Display.js, line 99
Default value: []
message_widgets
message_widgets :message_widgets
Defined in: Adventure/Display.js, line 67
Default value: []
object_description_widgets
object_description_widgets :object_description_widgets
Defined in: Adventure/Display.js, line 107
Default value: []
object_list_widgets
object_list_widgets :object_list_widgets
Defined in: Adventure/Display.js, line 83
Default value: []
room
room :String
room_description_widgets
room_description_widgets :room_description_widgets
Defined in: Adventure/Display.js, line 75
Default value: []
room_exits_widgets
room_exits_widgets :room_exits_widgets
Defined in: Adventure/Display.js, line 91
Default value: []
room_image_widgets
room_image_widgets :room_image_widgets
Defined in: Adventure/Display.js, line 115
Default value: []
score
score :String
title
title :String
verb_list_widgets
verb_list_widgets :verb_list_widgets
Defined in: Adventure/Display.js, line 59
Default value: []
version
version :String
widgets
widgets :widgets
Defined in: Adventure/Display.js, line 123
Default value: []