UserInterface with TextMessages implemented.

This commit is contained in:
Mal
2020-02-24 21:09:21 +01:00
parent 88d1c0db87
commit 479a150f9d
9 changed files with 167 additions and 41 deletions

24
js/ui/TextMessage.js Normal file
View File

@@ -0,0 +1,24 @@
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);
}
}