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

24 lines
656 B
JavaScript
Raw Permalink Normal View History

import TextBox from "./TextBox.js";
import GeometryPoint from "../geometry/GeometryPoint.js";
export default class TextMessage extends TextBox
{
constructor(text, context) {
super(text, window.innerWidth - 40, context);
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);
}
}