Class: Display
Defined in: adventure/Display.js, line 9
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:
-
game
Game
A reference to the game instance. -
displayElId
displayElId | HTMLElement
An ID for an HTML element to use as a display.
- Index
- Methods
- Properties
Index
Methods:
- clearInput
- clearOutput
- createCompass
- createImageDock
- createInventoryDock
- createVerbDock
- initialize
- printInput
- printWithInput
- sendToInput
- set
- setRoom
- setRoomImage
- setScore
- unsetCompasses
- unsetImageDocks
- unsetInventoryDocks
- unsetVerbDocks
- updateCompasses
- updateImageDocks
- updateInventoryDocks
- updateVerbDocks
Properties:
Methods Collapse all |
clearInput()
Defined in: adventure/display/clearInput.js, line 9
clearOutput()
Defined in: adventure/display/clearOutput.js, line 9
createCompass(properties) → {Element}
Defined in: adventure/display/createCompass.js, line 9
Parameters:
-
properties
Object
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.
createImageDock(properties) → {Element}
Defined in: adventure/display/createImageDock.js, line 9
Parameters:
-
properties
Object
HTML ID, CSS classes, and verbs.
MyGame.createImageDock({
"id":"MyImageDock",
"cssclasses":["custom"],
"images": [
[ "myimage_01": "/images/myimage_01.jpg" ],
[ "myimage_02": "/images/myimage_02.jpg" ],
],
});
For more information, see
Image Dock.
Returns:
Element
Returns the HTML element of the verb dock.
createInventoryDock(properties) → {Element}
Defined in: adventure/display/createInventoryDock.js, line 9
Parameters:
-
properties
Object
HTML ID, CSS classes, and verbs.
MyGame.createInventoryDock({
"id":"MyInventoryDock",
"cssclasses":["custom"]
});
For more information, see
GUI Inventory Dock.
Returns:
Element
Returns the HTML element of the verb dock.
createVerbDock(properties) → {Element}
Defined in: adventure/display/createVerbDock.js, line 9
Parameters:
-
properties
Object
HTML ID, CSS classes, and verbs.
MyGame.createVerbDock({
"id":"MyVerbDock",
"cssclasses":["custom"],
"verbs": ["save","restore","examine","take","use","drop"],
});
For more information, see
GUI Verb Dock.
Returns:
Element
Returns the HTML element of the verb dock.
initialize(props) → {adventurejs.Display}
Defined in: adventure/display/initialize.js, line 8
Parameters:
-
props
Object
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(msg, classes)
Defined in: adventure/display/print.js, line 9
Todos: add ability to pause at screen height so excess text doesn't scroll off screen
Parameters:
-
msg
String
An arbitrary string. -
classes
String
Optional class(es) to apply to output.
printInput(input)
Defined in: adventure/display/printInput.js, line 9
Parameters:
-
input
String
An arbitrary string.
printWithInput(msg, classes)
Defined in: adventure/display/printWithInput.js, line 9
Parameters:
-
msg
String
An arbitrary string. -
classes
String
Optional class(es) to apply to output.
sendToInput()
Defined in: adventure/display/sendToInput.js, line 9
set(props) → {adventurejs.Display}
Defined in: adventure/display/set.js, line 8
Parameters:
-
props
Object
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.)
setRoom(name) → {adventurejs.Display}
Defined in: adventure/display/setRoomName.js, line 9
Parameters:
-
name
String
Sets the Status Bar's Room field.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
setRoomImage(id) → {adventurejs.Display}
Defined in: adventure/display/setRoomImage.js, line 9
Parameters:
-
id
String
The id of an image in game.image_lookup.
Returns:
adventurejs.Display
Returns the instance the method is called on (useful for chaining calls.)
setScore(score) → {Display}
Defined in: adventure/display/setScore.js, line 9
Parameters:
-
score
String
Sets the Status Room field.
Returns:
Display
Returns the instance the method is called on (useful for chaining calls.)
unsetCompasses()
Defined in: adventure/display/unsetCompasses.js, line 9
unsetImageDocks(properties)
Defined in: adventure/display/unsetImageDocks.js, line 9
Parameters:
-
properties
Object
unsetInventoryDocks(properties)
Defined in: adventure/display/unsetInventoryDocks.js, line 9
Parameters:
-
properties
Object
unsetVerbDocks(properties)
Defined in: adventure/display/unsetVerbDocks.js, line 9
Parameters:
-
properties
Object
updateCompasses(exits)
Defined in: adventure/display/updateCompasses.js, line 9
Parameters:
-
exits
String
updateImageDocks(properties)
Defined in: adventure/display/updateImageDocks.js, line 9
Parameters:
-
properties
Object
updateInventoryDocks(properties)
Defined in: adventure/display/updateInventoryDocks.js, line 9
Todos: different lists for specific docks
Parameters:
-
properties
Object
updateVerbDocks(properties)
Defined in: adventure/display/updateVerbDocks.js, line 9
Parameters:
-
properties
Object
Properties |
author :String
compasses :compasses
Defined in: adventure/Display.js, line 37
Default value: []
displayEl :HTMLElement
Defined in: adventure/Display.js, line 70
Default value: null
displayElId :HTMLElement
Defined in: adventure/Display.js, line 77
Default value: null
game :Object
Defined in: adventure/Display.js, line 30
Default value: {}
imagedocks :imagedocks
Defined in: adventure/Display.js, line 62
Default value: []
inventorydocks :inventorydocks
Defined in: adventure/Display.js, line 54
Default value: []
room :String
score :String
title :String
verbdocks :verbdocks
Defined in: adventure/Display.js, line 46
Default value: []