Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Feodor0090/nmania
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.5.2
Choose a base ref
...
head repository: Feodor0090/nmania
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jun 17, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    cfec2b6 View commit details
  2. Add waveform image

    Feodor0090 committed Jun 17, 2023
    Copy the full SHA
    1bdead1 View commit details
  3. Copy the full SHA
    b7b8e7f View commit details
  4. Copy the full SHA
    f13bca1 View commit details
  5. Merge pull request #151 from Feodor0090/clock-offset-vis

    Clock offset visualizer
    Feodor0090 authored Jun 17, 2023
    Copy the full SHA
    d3778e0 View commit details
  6. Do not fit skin test

    Feodor0090 committed Jun 17, 2023
    Copy the full SHA
    73ceb33 View commit details
  7. Copy the full SHA
    dd4b89a View commit details
  8. Keep ui by default

    Feodor0090 committed Jun 17, 2023
    Copy the full SHA
    49d3331 View commit details
  9. Implement autofit

    Feodor0090 committed Jun 17, 2023
    Copy the full SHA
    e205b77 View commit details

Commits on Jun 18, 2023

  1. Copy the full SHA
    3e46fe1 View commit details
  2. Merge pull request #152 from Feodor0090/autofit

    Fit columns to screen if they take too much place
    Feodor0090 authored Jun 18, 2023
    Copy the full SHA
    0cb66c0 View commit details
  3. Copy the full SHA
    0214c07 View commit details
  4. Merge pull request #153 from Feodor0090/touch-vis-again

    Change look of first hold pointer
    Feodor0090 authored Jun 18, 2023
    Copy the full SHA
    91c1667 View commit details
  5. Copy the full SHA
    ade2282 View commit details
  6. Merge pull request #154 from Feodor0090/pause-delay

    Delay pause menu appearing for one second
    Feodor0090 authored Jun 18, 2023
    Copy the full SHA
    93f6e51 View commit details
  7. Fix break animation

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    13b60b8 View commit details
  8. Merge pull request #155 from Feodor0090/break-anim-again

    Fix break animation
    Feodor0090 authored Jun 18, 2023
    Copy the full SHA
    4e970d3 View commit details
  9. Bump version

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    e71c1dd View commit details
  10. Copy the full SHA
    b3656a4 View commit details
  11. Delete multisample code

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    24c6ed6 View commit details
  12. Delete settings item

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    7a1e7b8 View commit details
  13. Remove settings flag

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    be1ccd8 View commit details
  14. Delete hitsounds files

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    b367129 View commit details
  15. Merge pull request #156 from Feodor0090/no-hitsounds

    Delete hitsounds system from the game
    Feodor0090 authored Jun 18, 2023
    Copy the full SHA
    481bd4c View commit details
  16. Bump ver

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    900ca58 View commit details
  17. Update touch effects again

    Feodor0090 committed Jun 18, 2023
    Copy the full SHA
    eb3fa0f View commit details

Commits on Jun 21, 2023

  1. Compress gameplay samples

    Feodor0090 committed Jun 21, 2023
    Copy the full SHA
    5f77039 View commit details
  2. Copy the full SHA
    077f381 View commit details
  3. bump ver

    Feodor0090 committed Jun 21, 2023
    Copy the full SHA
    ba98aa8 View commit details
2 changes: 1 addition & 1 deletion Application Descriptor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Nokia-MIDlet-Background-Event: pause
MIDlet-Version: 2.5.2
MIDlet-Version: 2.6.2
MIDlet-Vendor: Feodor0090
MIDlet-Info-URL: https://github.com/Feodor0090/nmania
Nokia-UI-Enhancement: EnableMultiPointTouchEvents
Binary file added res/sfx/applause.mp3
Binary file not shown.
Binary file removed res/sfx/applause.wav
Binary file not shown.
Binary file removed res/sfx/drum-hitclap.wav
Binary file not shown.
Binary file removed res/sfx/drum-hitfinish.wav
Binary file not shown.
Binary file removed res/sfx/drum-hitnormal.wav
Binary file not shown.
Binary file removed res/sfx/drum-hitwhistle.wav
Binary file not shown.
Binary file removed res/sfx/normal-hitclap.wav
Binary file not shown.
Binary file removed res/sfx/normal-hitfinish.wav
Binary file not shown.
Binary file removed res/sfx/normal-hitnormal.wav
Binary file not shown.
Binary file removed res/sfx/normal-hitwhistle.wav
Binary file not shown.
Binary file added res/sfx/restart.mp3
Binary file not shown.
Binary file removed res/sfx/restart.wav
Binary file not shown.
Binary file removed res/sfx/soft-hitclap.wav
Binary file not shown.
Binary file removed res/sfx/soft-hitfinish.wav
Binary file not shown.
Binary file removed res/sfx/soft-hitnormal.wav
Binary file not shown.
Binary file removed res/sfx/soft-hitwhistle.wav
Binary file not shown.
Binary file added res/ui/exwf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 0 additions & 87 deletions src/nmania/MultiSample.java

This file was deleted.

116 changes: 68 additions & 48 deletions src/nmania/Player.java
Original file line number Diff line number Diff line change
@@ -173,32 +173,16 @@ public Player(Beatmap map, PlayerBootstrapData opts, Skin s, ILogger log, Displa
if (Settings.useBmsSamples && (sn = map.set.findFile("applause")) != null) {
applause = map.ToGlobalPath(sn);
} else {
applause = "/sfx/applause.wav";
applause = "/sfx/applause.mp3";
}
restart = new Sample("/sfx/restart.wav", "audio/wav");
restart = new Sample("/sfx/restart.mp3", "audio/mpeg");
} else {
combobreak = null;
sectionPass = null;
sectionFail = null;
restart = null;
applause = null;
}
if (Settings.hitSamples) { // ?full
String[] sets = new String[] { "normal", "soft", "drum" }; // ?full
String[] types = new String[] { "normal", "whistle", "finish", "clap" }; // ?full
hitSounds = new MultiSample[3][]; // ?full
for (int i = 0; i < sets.length; i++) { // ?full
hitSounds[i] = new MultiSample[types.length]; // ?full
for (int j = 0; j < types.length; j++) { // ?full
hitSounds[i][j] = new MultiSample(true, "/sfx/" + sets[i] + "-hit" + types[j] + ".wav", "audio/wav", // ?full
4); // ?full
Thread.sleep(1); // ?full
} // ?full
} // ?full
} else { // ?full
hitSounds = null; // ?full
} // ?full
defaultHSSet = map.defaultSampleSet; // ?full

// step 7: cache data for HUD drawing
log.log("Caching service data");
@@ -250,13 +234,35 @@ public Player(Beatmap map, PlayerBootstrapData opts, Skin s, ILogger log, Displa
}
// base stage metrics
{
// left offset autofit
int skinlo = s.GetLeftOffset();
int hudTakes = Settings.drawHUD ? Math.max(fillAccW, fillScoreW) : fontL.stringWidth("AUTO");
if (skinlo < 0)
skinlo = 0;
if (scrW - hudTakes - skinlo < 40)
skinlo = 0;
targetLeftOffset = skinlo;
leftOffset = targetLeftOffset;

int skinhw = s.GetHoldWidth();
int skincw = s.GetColumnWidth();
if (!data.forbidAftoFit) {
int colsTake = columnsCount * skincw;
int avail = scrW - hudTakes - skinlo - HEALTH_WIDTH;
if (avail < colsTake) {
skincw = (avail / columnsCount) - 2;
}
}
if (skincw < 0)
skincw = 1;
if (skinhw > skincw)
skinhw = skincw;

kbH = s.GetKeyboardHeight();
colW = s.GetColumnWidth();
colW = skincw;
colWp1 = colW + 1;
noteH = s.GetNoteHeight();
holdW = s.GetHoldWidth();
targetLeftOffset = s.GetLeftOffset();
leftOffset = targetLeftOffset;
holdW = skinhw;
}
// calculated stage metrics
{
@@ -442,6 +448,10 @@ private final void UpdateHealthX() {
* block input.
*/
public boolean isPaused = false;
/**
* Set this flag to true to allow interacting with pause menu.
*/
public boolean hudAcceptsInput = true;
/**
* Make this flag false to end update loop.
*/
@@ -463,9 +473,7 @@ private final void UpdateHealthX() {
private final Sample sectionFail;
private final Sample fail = null;
private final Sample restart;
private final MultiSample[][] hitSounds; // ?full
private final String applause;
private final int defaultHSSet; // ?full

public final static String[] judgements = new String[] { "MISS", "MEH", "OK", "GOOD", "GREAT", "PERFECT" };
public final static int[] judgementColors = new int[] { SNUtils.toARGB("0xF00"), SNUtils.toARGB("0xFA0"),
@@ -477,13 +485,6 @@ private final void UpdateHealthX() {
* Clears allocated samples.
*/
public final void Dispose() {
if (hitSounds != null) { // ?full
for (int i = 0; i < hitSounds.length; i++) { // ?full
for (int j = 0; j < hitSounds[i].length; j++) { // ?full
hitSounds[i][j].Dispose(); // ?full
} // ?full
} // ?full
} // ?full
if (restart != null)
restart.Dispose();
if (combobreak != null)
@@ -498,6 +499,8 @@ public final void Dispose() {

protected final void keyPressed(final int k) {
if (isPaused && !failed) {
if (!hudAcceptsInput)
return;
if (k == -1 || k == '2') {
pauseItem--;
if (pauseItem < 0)
@@ -523,6 +526,8 @@ protected final void keyPressed(final int k) {
return;
}
if (isPaused && failed) {
if (!hudAcceptsInput)
return;
if (k == -1 || k == '2' || k == -2 || k == '8') {
pauseItem = pauseItem == 0 ? 1 : 0;
return;
@@ -628,6 +633,8 @@ public final void TriggerPause() {

protected final void pointerPressed(final int x, final int y) {
if (isPaused) {
if (!hudAcceptsInput)
return;
if (failed) {
if (y < scrH / 3)
return;
@@ -755,15 +762,17 @@ public final void Loop() {
} else if (timeleft < 500) {
// fading playfield in (break will end soon)
int fade = scrH * (500 - timeleft) / 500;
g.setClip(0, 0, scrW, fade);
FillBg();
g.setClip(0, 0, scrW, fade); // clip for stage
RedrawAllHUD();
DrawBorders();
for (int i = 0; i < columnsCount; i++) {
DrawKey(i, false);
}
Redraw(true);
RedrawAllHUD();
g.setClip(0, 0, scrW, scrH);
g.setClip(0, 0, scrW, Math.min(kbY, fade)); // clip for notes
RedrawNotes();
g.setClip(0, 0, scrW, scrH); // clip reset
flushGraphics();
} else {
// idle (break is in progress)
g.setClip(0, 0, scrW, scrH);
@@ -825,10 +834,6 @@ else if (!colKey && lastHoldKeys[column])
+ column + " is hit"); // ?dbg
CountHit(j);
currentNote[column] += 2;
if (hitSounds != null) { // ?full
if (j != 0) // ?full
hitSounds[defaultHSSet][0].Play(); // ?full
} // ?full
break; // loop on HW
}
}
@@ -848,10 +853,6 @@ else if (!colKey && lastHoldKeys[column])
GL.Log("(detect) Head note at " + columns[column][currentNote[column]] + " c="
+ column + " is hit"); // ?dbg
CountHit(j);
if (hitSounds != null) { // ?full
if (j != 0) // ?full
hitSounds[defaultHSSet][0].Play(); // ?full
} // ?full
holdHeadScored[column] = true;
break; // loop on HW
}
@@ -886,10 +887,6 @@ else if (!colKey && lastHoldKeys[column])
CountHit(j);
currentNote[column] += 2;
holdHeadScored[column] = false;
if (hitSounds != null) { // ?full
if (j != 0) // ?full
hitSounds[defaultHSSet][2].Play(); // ?full
} // ?full
break;
}
}
@@ -1017,6 +1014,27 @@ private final void PassSequence() {
* Loop method, that handles pause menu redrawing.
*/
private final void PauseUpdateLoop() {
hudAcceptsInput = false; // block overlay while it's not visible
long s = System.currentTimeMillis();
while (true) {
int p = (int) (System.currentTimeMillis() - s);
if (p < 1000) {
final int a = 360 - (p * 360 / 1000);
final int x = scrW / 2 - 30;
final int y = scrH / 2 - 30;
final int d = 60;
g.setColor(-1);
g.fillArc(x, y, d, d, 0, 360);
g.setColor(0);
g.fillArc(x, y, d, d, 90, a);
g.setColor(-1);
g.drawArc(x - 1, y - 1, d, d, 0, 360);
flushGraphics();
} else {
hudAcceptsInput = true;
break;
}
}
while (isPaused) {
int sh3 = scrH / 3;
int bh = sh3 * 2 / 3;
@@ -1221,7 +1239,9 @@ private final void Refill() {
}

/**
* Method to redraw hot areas. Called by update loop.
* Method to redraw hot areas. Called by update loop. Performs flush.
*
* @param flushAll True to force fullscreen.
*/
private final void Redraw(boolean flushAll) {
g.setClip(0, 0, scrW, kbY);
5 changes: 5 additions & 0 deletions src/nmania/PlayerBootstrapData.java
Original file line number Diff line number Diff line change
@@ -28,6 +28,11 @@ public final class PlayerBootstrapData {

public boolean recordReplay;

/**
* If true, columns won't be fit into screen.
*/
public boolean forbidAftoFit;

/**
* If false, previous {@link IDisplay} or {@link Displayable} will not be kept
* when swithing displayables.
5 changes: 4 additions & 1 deletion src/nmania/Sample.java
Original file line number Diff line number Diff line change
@@ -13,7 +13,10 @@ public Sample(String file, String type) throws IOException, MediaException {
player = Manager.createPlayer(file);
} else {
if (type == null) {
type = "audio/" + file.substring(file.lastIndexOf('.') + 1, file.length());
String ext = file.substring(file.lastIndexOf('.') + 1, file.length()).toLowerCase();
if ("mp3".equals(ext))
ext = "mpeg";
type = "audio/" + ext;
}
player = Manager.createPlayer(getClass().getResourceAsStream(file), type);
}
8 changes: 1 addition & 7 deletions src/nmania/Settings.java
Original file line number Diff line number Diff line change
@@ -49,10 +49,6 @@ else if (dir.charAt(dir.length() - 1) != '/')
* Are exit/fail/pass/restart samples enabled?
*/
public static boolean gameplaySamples = false;
/**
* Are hit samples enabled?
*/
public static boolean hitSamples = false;
/**
* If hit samples are enabled, do we want to load them from beatmap?
*/
@@ -148,7 +144,6 @@ public static final String Serialize() {
}
j.accumulate("keys", keys);
j.accumulate("samples", new Boolean(gameplaySamples));
j.accumulate("hitsounds", new Boolean(hitSamples));
j.accumulate("keepmenu", new Boolean(keepMenu));
j.accumulate("drawcounters", new Boolean(drawHUD));
j.accumulate("fullscreenflush", new Boolean(fullScreenFlush));
@@ -215,8 +210,7 @@ public static final void Load() {
}
}
gameplaySamples = j.optBoolean("samples", true); // ?full
hitSamples = j.optBoolean("hitsounds", false); // ?full
keepMenu = j.optBoolean("keepmenu", false); // ?full
keepMenu = j.optBoolean("keepmenu", true); // ?full
drawHUD = j.optBoolean("drawcounters", true);
final String device = Nmania.GetDevice();
fullScreenFlush = j.optBoolean("fullscreenflush",
2 changes: 1 addition & 1 deletion src/nmania/replays/AutoplayRunner.java
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ public void Reset() {
}

public String GetName() {
return "AUTOPLAY";
return "AUTO";
}

public String GetPlayerName() {
8 changes: 3 additions & 5 deletions src/nmania/ui/ng/AudioSettings.java
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ public class AudioSettings extends ListScreen implements IListSelectHandler, INu
public AudioSettings() {
SetItems(new ListItem[] { //
new SwitchItem(0, "Play music in menu", this, Settings.musicInMenu), // ?full
new SwitchItem(1, "Enable hitsounds", this, Settings.hitSamples), // ?full
new SwitchItem(2, "Enable feedback samples", this, Settings.gameplaySamples), // ?full
new SwitchItem(3, "Use BMS's sounds", this, Settings.useBmsSamples), // ?full
new DataItem(4, "Clock offset", this, Settings.gameplayOffset + "ms"),
@@ -23,7 +22,7 @@ public String GetOption() {

public void OnOptionActivate(IDisplay d) {
d.Push(new Alert("AUDIO SETTINGS",
"Feedback samples - sounds like restart, fail, pass, etc. \n BMS's sounds - usage of effects provided by loaded beatmap, not default ones. \n Clock offset - set to positive to make notes appear earlier than music, set to negative to make notes appear before than music. Value is in milliseconds (1000 is 1 second)."));
"Feedback samples - sounds like restart, fail, pass, etc. \n BMS's sounds - usage of effects provided by loaded beatmap, not default ones."));
}

public void OnSelect(ListItem item, ListScreen screen, IDisplay display) {
@@ -36,8 +35,7 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) {
}
break;
case 1:
Settings.hitSamples = !Settings.hitSamples;
((SwitchItem) item).Toggle();
// hitsounds (deleted)
break;
case 2:
Settings.gameplaySamples = !Settings.gameplaySamples;
@@ -48,7 +46,7 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) {
((SwitchItem) item).Toggle();
break;
case 4:
display.Push(new NumberBox("Clock offset", 0, this, Settings.gameplayOffset, true));
display.Push(new OffsetBox(0, this, Settings.gameplayOffset, true));
break;
case 5:
NumberBox nb = new NumberBox("Audio volume (%)", 1, this, Settings.volume, false);
64 changes: 41 additions & 23 deletions src/nmania/ui/ng/NmaniaDisplay.java
Original file line number Diff line number Diff line change
@@ -261,11 +261,19 @@ private final void DrawLogo(int lx, int ly) {
if (music == null) {
p = (System.currentTimeMillis() % 10000) / 10000f;
}
DrawDisc(lx, ly, logo.getHeight(), p);
FillDisc(lx, ly, logo.getHeight(), p);
g.drawImage(logo, lx, ly, 0);
}

private final void DrawDisc(int x, int y, int s, float p) {
/**
* Fills nmania-branded 4-colored disc.
*
* @param x X of top-left.
* @param y Y of top-left.
* @param s Diameter.
* @param p Value from 0.0 to 1.0 setting angle.
*/
private final void FillDisc(int x, int y, int s, float p) {
g.setColor(PINK_COLOR);
g.fillArc(x, y, s, s, (int) (360 * p), 90);
g.setColor(NMANIA_COLOR);
@@ -276,39 +284,49 @@ private final void DrawDisc(int x, int y, int s, float p) {
g.fillArc(x, y, s, s, (int) (360 * p) + 180, 90);
}

/**
* Draws nmania-branded 4-colored circle border.
*
* @param x X of top-left.
* @param y Y of top-left.
* @param s Diameter.
* @param p Value from 0.0 to 1.0 setting angle.
*/
private final void DrawDisc(int x, int y, int s, float p) {
g.setColor(PINK_COLOR);
g.drawArc(x, y, s, s, (int) (360 * p), 90);
g.setColor(NMANIA_COLOR);
g.drawArc(x, y, s, s, (int) (360 * p) + 90, 90);
g.setColor(NEGATIVE_COLOR);
g.drawArc(x, y, s, s, (int) (360 * p) - 90, 90);
g.setColor(BG_COLOR);
g.drawArc(x, y, s, s, (int) (360 * p) + 180, 90);
}

private final void DrawTouchEffect() {
long now = System.currentTimeMillis();
float spinState = (now % 1000L) / 1000f;
if (pointerState == 1 || pointerState == 2) {
int s = 0;
if (now - lastPointerStateChange < 175) {
s = (int) ((now - lastPointerStateChange) / 25);
} else {
s = 7;
}
DrawDisc(px - s, py - s, s << 1, spinState);
g.setColor(-1);
s--;
g.drawArc(px - s - 1, py - s - 1, (s << 1) + 1, (s << 1) + 1, 0, 360);
} else if (now - lastPointerStateChange < 300) {
int p = 255 * (int) (now - lastPointerStateChange) / 300;
int fa = 180 * (int) (now - lastPointerStateChange) / 300;
int s = (int) ((now - lastPointerStateChange) / 10);
g.setColor(ColorUtils.blend(BG_COLOR, -1, p));
g.fillArc(px - 7, py - 7, 14, 14, 90 + fa, 360 - (fa << 1));
g.drawArc(px - 6 - s, py - 6 - s, 12 + (s << 1), 12 + (s << 1), 0, 360);
int pr = 8;
FillDisc(px - pr, py - pr, pr << 1, spinState);
if (pointerState == 2)
DrawDisc(px - 40, py - 40, 80, spinState);
} else if (now - lastPointerStateChange < 100) {
int dl = (int) (now - lastPointerStateChange);
int pr = 8 - (dl * 8 / 100);
FillDisc(px - pr, py - pr, pr << 1, spinState);
pr = 40 - (dl * 40 / 100);
DrawDisc(px - pr, py - pr, pr << 1, spinState);
}

g.setColor(PINK_COLOR);
for (int i = 0; i < 10; i++) {
if (multiPointers[i * 2] >= 0) {
int x = multiPointers[i * 2];
int y = multiPointers[i * 2 + 1];
g.drawArc(x - 30, y - 30, 60, 60, 0, 360);
g.drawArc(x - 35, y - 35, 70, 70, 0, 360);
g.setColor(PINK_COLOR);
g.drawArc(x - 40, y - 40, 80, 80, 0, 360);
g.drawArc(x - 45, y - 45, 90, 90, 0, 360);
g.drawArc(x - 50, y - 50, 100, 100, 0, 360);
DrawDisc(x - 50, y - 50, 100, spinState);
}
}
}
12 changes: 6 additions & 6 deletions src/nmania/ui/ng/NumberBox.java
Original file line number Diff line number Diff line change
@@ -51,16 +51,16 @@ public void OnOptionActivate(IDisplay d) {
public void Paint(Graphics g, int w, int h) {
g.setFont(num);
int fh = num.getHeight();
int offs = fh;
int offs = 10;
if (showPlusMinus) {
offs += 40;
offs += 35;
int b = (int) (Math.abs(1f - NmaniaDisplay.beatProgress * 2f) * 32);
g.setColor(ColorUtils.blend(-1, NmaniaDisplay.PINK_COLOR, b));
g.fillRoundRect(fh, 10, 35, fh, fh, fh);
g.fillRoundRect(w - fh - 35, 10, 35, fh, fh, fh);
g.fillRoundRect(1, 10, 34, fh, fh, fh);
g.fillRoundRect(w - 35, 10, 34, fh, fh, fh);
g.setColor(-1);
g.drawString("-1", fh + 17, 10, Graphics.TOP | Graphics.HCENTER);
g.drawString("+1", w - fh - 17, 10, Graphics.TOP | Graphics.HCENTER);
g.drawString("-1", 18, 10, Graphics.TOP | Graphics.HCENTER);
g.drawString("+1", w - 18, 10, Graphics.TOP | Graphics.HCENTER);
}

g.setColor(NmaniaDisplay.NEGATIVE_COLOR);
64 changes: 64 additions & 0 deletions src/nmania/ui/ng/OffsetBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package nmania.ui.ng;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

import nmania.GL;
import tube42.lib.imagelib.ColorUtils;

public class OffsetBox extends NumberBox {

public OffsetBox(int UUID, INumberBoxHandler handler, int value, boolean allowNegative) {
super("Clock offset", UUID, handler, value, allowNegative);
showPlusMinus = true;
try {
wf = Image.createImage("/ui/exwf.png");
} catch (IOException e) {
GL.Log("Failed to load waveform image, screen will fail!");
}
}

private Image wf;

public void Paint(Graphics g, int w, int h) {
g.setColor(0);
g.fillRect(w - 46, 5, 42, h - 10);
g.setColor(-1);
g.drawRect(w - 46, 5, 41, h - 11);
int time = (int) (System.currentTimeMillis() % 723);
int pprogress = (723 - time) * 112 / 723;
// waveform
{
g.drawRegion(wf, 112 - pprogress, 0, pprogress, 52, Sprite.TRANS_MIRROR_ROT90, w - 101, h - 5 - pprogress,
0);
int cy = h - 5 - pprogress - 112;
while (cy > 5) {
g.drawRegion(wf, 0, 0, 112, 52, Sprite.TRANS_MIRROR_ROT90, w - 101, cy, 0);
cy -= 112;
}
int ty = -(cy - 5);
g.drawRegion(wf, 0, 0, 112 - ty, 52, Sprite.TRANS_MIRROR_ROT90, w - 101, 5, 0);
}
// notes
for (int i = -2; i < 30; i++) {
int ny = h - 6 - pprogress - (56 * i) - (value * 112 / 723);
for (int j = 0; j < 25; j++) {
int ly = ny - j;
if (ly <= 5)
break;
if (ly >= h - 6)
continue;
g.setColor(ColorUtils.blend(0, 0x00ff00, j * 255 / 24));
g.drawLine(w - 45, ly, w - 6, ly);
}
}
super.Paint(g, w - 105, h);
}

public void OnTouch(IDisplay d, int s, int x, int y, int dx, int dy, int w, int h) {
super.OnTouch(d, s, x, y, dx, dy, w - 105, h);
}
}
1 change: 1 addition & 0 deletions src/nmania/ui/ng/SkinSettings.java
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ public void OnOptionActivate(IDisplay d) {
pbd.mods = new ModsState();
pbd.recordReplay = false;
pbd.keepBackScreen = true;
pbd.forbidAftoFit = true; // to show true widths
pbd.set = testBms;
pbd.input = new AutoplayRunner();
PlayerLoaderScreen pls = new PlayerLoaderScreen(pbd);