mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
UserInterface with TextMessages implemented.
This commit is contained in:
24
js/ui/TextMessage.js
Normal file
24
js/ui/TextMessage.js
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user