Use showPromt() instead of own implementation

as it works with Bangle.js2
master
Adam Schmalhofer 2021-11-18 16:27:09 +01:00
parent 3dba1342e8
commit f035f36ba9
1 changed files with 9 additions and 14 deletions

View File

@ -168,15 +168,9 @@ class DoneState extends State {
setButtons () { setButtons () {
this.device.setBTN1(() => { this.device.setBTN1(() => {
const initState = new InitState(this.device);
clearTimeout(this.timeout);
initState.go();
}); });
this.device.setBTN3(() => { this.device.setBTN3(() => {
const breakState = new BreakState(this.device);
clearTimeout(this.timeout);
breakState.go();
}); });
this.device.setBTN2(() => { this.device.setBTN2(() => {
@ -185,14 +179,15 @@ class DoneState extends State {
draw () { draw () {
g.clear(); g.clear();
g.setFont("6x8", 2); E.showPrompt("You are a hero!", {
g.setFontAlign(0, 0, 3); buttons : {"AGAIN":1,"BREAK":2}
g.drawString("AGAIN", 230, 50); }).then((v) => {
g.drawString("BREAK", 230, 190); var nextSate = (v == 1
g.setFont("Vector", 45); ? new InitState(this.device)
g.setFontAlign(-1, -1); : new BreakState(this.device));
clearTimeout(this.timeout);
g.drawString('You\nare\na\nhero!', 50, 40); nextSate.go();
});
} }
init () { init () {