mr-crocs-adventures/js/ui/TextMessage.js

25 lines
681 B
JavaScript
Raw Normal View History

import TextBox from "./TextBox.js";
import GeometryPoint from "../geometry/GeometryPoint.js";
export default class TextMessage extends TextBox
{
constructor(text, context, paused = false) {
super(text, window.innerWidth - 40, context, paused);
this.update();
this.context = context;
}
update()
{
this.defaultWidth = window.innerWidth - 40;
this.defaultPosition = new GeometryPoint(window.innerWidth * 0.5, window.innerHeight - 100);
}
render()
{
this.update();
this.setPosition(this.defaultPosition.x, this.defaultPosition.y);
this.updateLines(this.defaultWidth, this.context);
}
}