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:
38
js/ui/UserInterfaceElement.js
Normal file
38
js/ui/UserInterfaceElement.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import GeometryPoint from "../geometry/GeometryPoint.js";
|
||||
|
||||
export default class UserInterfaceElement
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this.position = new GeometryPoint(0, 0);
|
||||
this.isVisible = true;
|
||||
}
|
||||
|
||||
setPosition(x, y)
|
||||
{
|
||||
this.position.x = x;
|
||||
this.position.y = y;
|
||||
}
|
||||
|
||||
hide(timeoutMilliseconds = 0)
|
||||
{
|
||||
setTimeout(
|
||||
() => {
|
||||
this.isVisible = false
|
||||
}, timeoutMilliseconds
|
||||
);
|
||||
}
|
||||
|
||||
show(timeoutMilliseconds = 0)
|
||||
{
|
||||
if (timeoutMilliseconds > 0) {
|
||||
this.isVisible = false;
|
||||
}
|
||||
|
||||
setTimeout(
|
||||
() => {
|
||||
this.isVisible = true;
|
||||
}, timeoutMilliseconds
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user