Skip to content

Commit

Permalink
Process taps
Browse files Browse the repository at this point in the history
  • Loading branch information
Feodor0090 authored Nov 2, 2022
1 parent e9fa336 commit 1e298d6
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/nmania/ui/ng/NumberBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void Paint(Graphics g, int w, int h) {
g.drawString(sign ? "0" : "-0", w - fh - (fh >> 1), 10, Graphics.TOP | Graphics.RIGHT);
else
g.drawString(String.valueOf(value), w - fh - (fh >> 1), 10, Graphics.TOP | Graphics.RIGHT);
PaintPad(g, w, 10+fh+10);
PaintPad(g, w, fh + 20);
}

private final void PaintPad(Graphics g, int w, int y) {
Expand Down Expand Up @@ -105,5 +105,36 @@ private void ApplySign() {
}

public void OnTouch(IDisplay d, int s, int x, int y, int dx, int dy, int w, int h) {
if (s == 1) {
int fh = num.getHeight();
y -= fh + 20;
if (y < 0)
return;
if (y < fh + 2) {
OnKey(d, '1'+(x*3/w));
return;
}
y -= fh + 2;
if (y < fh + 2) {
OnKey(d, '4'+(x*3/w));
return;
}
y -= fh + 2;
if (y < fh + 2) {
OnKey(d, '7'+(x*3/w));
return;
}
y -= fh + 2;
if (y < fh + 2) {
if (x < w/3) {
OnKey(d, Canvas.KEY_STAR);
} else if (x < w*2/3) {
OnKey(d, '0');
} else {
OnKey(d, Canvas.KEY_POUND);
}
return;
}
}
}
}

0 comments on commit 1e298d6

Please sign in to comment.