// print.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Display.prototype;
/**
* Global method for printing text to game display.
* @memberOf AdventureJS.Display
* @method AdventureJS.Display#print
* @param {String} msg An arbitrary string.
* @param {String} classes Optional class(es) to apply to output.
* @TODO add ability to pause at screen height so excess text doesn't scroll off screen
*/
p.print = function Display_print(msg, classes) {
const msgEl = document.createElement("div");
msgEl.innerHTML = msg;
msgEl.classList = `ajs-p ${classes}`;
this.outputEl.append(msgEl);
this.outputWrapperEl.scrollTo({
top: this.outputWrapperEl.scrollHeight,
left: 0,
behavior: "smooth",
});
return msg;
};
})();