diff --git a/src/nmania/ui/ng/NumberBox.java b/src/nmania/ui/ng/NumberBox.java index bba3b918..212cf6e2 100644 --- a/src/nmania/ui/ng/NumberBox.java +++ b/src/nmania/ui/ng/NumberBox.java @@ -13,6 +13,12 @@ public class NumberBox extends Screen { private Font num = Font.getFont(0, 0, 8); private Font buttons = Font.getFont(0, 0, 0); private boolean sign; + private final char[][] pad = new char[][] { + new char[] {'1','2','3'}, + new char[] {'4','5','6'}, + new char[] {'7','8','9'}, + new char[] {'-','0','<'}, + }; public NumberBox(String title, int UUID, INumberBoxHandler handler, int value, boolean allowNegative) { this.title = title; @@ -51,6 +57,22 @@ 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, fh + 20); + } + + private final void PaintPad(Graphics g, int w, int y) { + int fh = num.getHeight(); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 3; j++) { + if(i == 3 && j == 0 && !allowNegative) + continue; + g.setColor(NmaniaDisplay.PINK_COLOR); + g.fillRoundRect(j*w/3 + 1, y, w/3 - 2, fh, fh, fh); + g.setColor(-1); + g.drawChar(pad[i][j], j*w/3 + w/6, y, Graphics.TOP | Graphics.HCENTER); + } + y += fh + 2; + } } public void OnKey(IDisplay d, int k) { @@ -85,5 +107,37 @@ 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) { + if (allowNegative) + OnKey(d, Canvas.KEY_STAR); + } else if (x < w*2/3) { + OnKey(d, '0'); + } else { + OnKey(d, Canvas.KEY_POUND); + } + return; + } + } } } diff --git a/src/nmania/ui/ng/VisualSettings.java b/src/nmania/ui/ng/VisualSettings.java index 6dc70db6..edecb038 100644 --- a/src/nmania/ui/ng/VisualSettings.java +++ b/src/nmania/ui/ng/VisualSettings.java @@ -31,8 +31,10 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { switch (item.UUID) { case 0: display.Push(new NumberBox("Dim %", 0, this, Settings.dimLevel, false)); + break; case 1: display.Push(new NumberBox("Scroll speed (divider)", 1, this, Settings.speedDiv, false)); + break; case 2: Settings.drawHUD = !Settings.drawHUD; ((SwitchItem) item).Toggle();