Skin options: CursorRotate, CursorExpand, SpinnerFadePlayfield, CursorTrailRotate, ComboBurstRandom, Combo[1-8], SongSelect(Active|Inactive)Text.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-05-24 22:17:45 -04:00
parent 40e4495030
commit b804a4d154
8 changed files with 47 additions and 33 deletions

View File

@ -114,6 +114,9 @@ public class Container extends AppGameContainer {
// save user options // save user options
Options.saveOptions(); Options.saveOptions();
// reset cursor
UI.resetCursor();
// destroy images // destroy images
InternalTextureLoader.get().clear(); InternalTextureLoader.get().clear();

View File

@ -1124,10 +1124,14 @@ public class GameData {
// combo bursts (at 30, 60, 100+50x) // combo bursts (at 30, 60, 100+50x)
if (Options.isComboBurstEnabled() && if (Options.isComboBurstEnabled() &&
(combo == 30 || combo == 60 || (combo >= 100 && combo % 50 == 0))) { (combo == 30 || combo == 60 || (combo >= 100 && combo % 50 == 0))) {
if (Options.getSkin().isComboBurstRandom())
comboBurstIndex = (int) (Math.random() * comboBurstImages.length);
else {
if (combo == 30) if (combo == 30)
comboBurstIndex = 0; comboBurstIndex = 0;
else else
comboBurstIndex = (comboBurstIndex + 1) % comboBurstImages.length; comboBurstIndex = (comboBurstIndex + 1) % comboBurstImages.length;
}
comboBurstAlpha = 0.8f; comboBurstAlpha = 0.8f;
if ((comboBurstIndex % 2) == 0) if ((comboBurstIndex % 2) == 0)
comboBurstX = width; comboBurstX = width;

View File

@ -529,8 +529,10 @@ public class OsuParser {
line, file.getAbsolutePath()), e); line, file.getAbsolutePath()), e);
} }
} }
if (!colors.isEmpty()) if (!colors.isEmpty()) {
beatmap.combo = colors.toArray(new Color[colors.size()]); beatmap.combo = colors.toArray(new Color[colors.size()]);
beatmap.isDefaultCombo = false;
}
break; break;
case "[HitObjects]": case "[HitObjects]":
int type = 0; int type = 0;
@ -585,8 +587,10 @@ public class OsuParser {
return null; return null;
// if no custom colors, use the default color scheme // if no custom colors, use the default color scheme
if (beatmap.combo == null) if (beatmap.combo == null) {
beatmap.combo = Utils.DEFAULT_COMBO; beatmap.combo = Options.getSkin().getComboColors();
beatmap.isDefaultCombo = true;
}
// parse hit objects now? // parse hit objects now?
if (parseObjects) if (parseObjects)

View File

@ -19,6 +19,7 @@
package itdelatrisu.opsu; package itdelatrisu.opsu;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.skins.Skin;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.util.Iterator; import java.util.Iterator;
@ -242,6 +243,7 @@ public class UI {
int removeCount = 0; int removeCount = 0;
int FPSmod = (Options.getTargetFPS() / 60); int FPSmod = (Options.getTargetFPS() / 60);
Skin skin = Options.getSkin();
// TODO: use an image buffer // TODO: use an image buffer
if (newStyle) { if (newStyle) {
@ -275,6 +277,8 @@ public class UI {
// draw a fading trail // draw a fading trail
float alpha = 0f; float alpha = 0f;
float t = 2f / cursorX.size(); float t = 2f / cursorX.size();
if (skin.isCursorTrailRotated())
cursorTrail.setRotation(cursorAngle);
Iterator<Integer> iterX = cursorX.iterator(); Iterator<Integer> iterX = cursorX.iterator();
Iterator<Integer> iterY = cursorY.iterator(); Iterator<Integer> iterY = cursorY.iterator();
while (iterX.hasNext()) { while (iterX.hasNext()) {
@ -288,15 +292,15 @@ public class UI {
cursorTrail.drawCentered(mouseX, mouseY); cursorTrail.drawCentered(mouseX, mouseY);
// increase the cursor size if pressed // increase the cursor size if pressed
if (mousePressed && skin.isCursorExpanded()) {
final float scale = 1.25f; final float scale = 1.25f;
if (mousePressed) {
cursor = cursor.getScaledCopy(scale); cursor = cursor.getScaledCopy(scale);
if (newStyle) if (newStyle)
cursorMiddle = cursorMiddle.getScaledCopy(scale); cursorMiddle = cursorMiddle.getScaledCopy(scale);
} }
// draw the other components // draw the other components
if (newStyle) if (newStyle && skin.isCursorRotated())
cursor.setRotation(cursorAngle); cursor.setRotation(cursorAngle);
cursor.drawCentered(mouseX, mouseY); cursor.drawCentered(mouseX, mouseY);
if (newStyle) if (newStyle)
@ -373,6 +377,7 @@ public class UI {
GameImage.CURSOR_TRAIL.destroySkinImage(); GameImage.CURSOR_TRAIL.destroySkinImage();
cursorAngle = 0f; cursorAngle = 0f;
GameImage.CURSOR.getImage().setRotation(0f); GameImage.CURSOR.getImage().setRotation(0f);
GameImage.CURSOR_TRAIL.getImage().setRotation(0f);
} }
/** /**

View File

@ -84,10 +84,6 @@ public class Utils {
COLOR_BLUE_BACKGROUND = new Color(74, 130, 255), COLOR_BLUE_BACKGROUND = new Color(74, 130, 255),
COLOR_BLUE_BUTTON = new Color(40, 129, 237), COLOR_BLUE_BUTTON = new Color(40, 129, 237),
COLOR_ORANGE_BUTTON = new Color(200, 90, 3), COLOR_ORANGE_BUTTON = new Color(200, 90, 3),
COLOR_GREEN_OBJECT = new Color(26, 207, 26),
COLOR_BLUE_OBJECT = new Color(46, 136, 248),
COLOR_RED_OBJECT = new Color(243, 48, 77),
COLOR_ORANGE_OBJECT = new Color(255, 200, 32),
COLOR_YELLOW_ALPHA = new Color(255, 255, 0, 0.4f), COLOR_YELLOW_ALPHA = new Color(255, 255, 0, 0.4f),
COLOR_WHITE_FADE = new Color(255, 255, 255, 1f), COLOR_WHITE_FADE = new Color(255, 255, 255, 1f),
COLOR_RED_HOVER = new Color(255, 112, 112), COLOR_RED_HOVER = new Color(255, 112, 112),
@ -100,12 +96,6 @@ public class Utils {
COLOR_RED_HIGHLIGHT = new Color(246, 154, 161), COLOR_RED_HIGHLIGHT = new Color(246, 154, 161),
COLOR_BLUE_HIGHLIGHT = new Color(173, 216, 230); COLOR_BLUE_HIGHLIGHT = new Color(173, 216, 230);
/** The default map colors, used when a map does not provide custom colors. */
public static final Color[] DEFAULT_COMBO = {
COLOR_ORANGE_OBJECT, COLOR_GREEN_OBJECT,
COLOR_BLUE_OBJECT, COLOR_RED_OBJECT,
};
/** Game fonts. */ /** Game fonts. */
public static UnicodeFont public static UnicodeFont
FONT_DEFAULT, FONT_BOLD, FONT_DEFAULT, FONT_BOLD,

View File

@ -19,7 +19,6 @@
package itdelatrisu.opsu.beatmap; package itdelatrisu.opsu.beatmap;
import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.Utils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -183,6 +182,9 @@ public class Beatmap implements Comparable<Beatmap> {
/** Combo colors (max 8). */ /** Combo colors (max 8). */
public Color[] combo; public Color[] combo;
/** Whether the combo is the default skin combo (true) or a beatmap combo (false). */
public boolean isDefaultCombo = true;
/** /**
* [HitObjects] * [HitObjects]
*/ */
@ -400,7 +402,7 @@ public class Beatmap implements Comparable<Beatmap> {
* or null if the field is null or the default combo. * or null if the field is null or the default combo.
*/ */
public String comboToString() { public String comboToString() {
if (combo == null || combo == Utils.DEFAULT_COMBO) if (combo == null || isDefaultCombo)
return null; return null;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -423,7 +425,8 @@ public class Beatmap implements Comparable<Beatmap> {
* @param s the string * @param s the string
*/ */
public void comboFromString(String s) { public void comboFromString(String s) {
this.combo = Utils.DEFAULT_COMBO; this.combo = Options.getSkin().getComboColors();
this.isDefaultCombo = true;
if (s == null) if (s == null)
return; return;
@ -433,7 +436,9 @@ public class Beatmap implements Comparable<Beatmap> {
String[] rgb = tokens[i].split(","); String[] rgb = tokens[i].split(",");
colors.add(new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]))); colors.add(new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])));
} }
if (!colors.isEmpty()) if (!colors.isEmpty()) {
this.combo = colors.toArray(new Color[colors.size()]); this.combo = colors.toArray(new Color[colors.size()]);
this.isDefaultCombo = false;
}
} }
} }

View File

@ -69,14 +69,14 @@ public class BeatmapSetNode {
Beatmap beatmap; Beatmap beatmap;
bg.setAlpha(0.9f); bg.setAlpha(0.9f);
Color bgColor; Color bgColor;
Color textColor = Color.lightGray; Color textColor = Options.getSkin().getSongSelectInactiveTextColor();
// get drawing parameters // get drawing parameters
if (expanded) { if (expanded) {
x -= bg.getWidth() / 10f; x -= bg.getWidth() / 10f;
if (focus) { if (focus) {
bgColor = Color.white; bgColor = Color.white;
textColor = Color.white; textColor = Options.getSkin().getSongSelectActiveTextColor();
} else } else
bgColor = Utils.COLOR_BLUE_BUTTON; bgColor = Utils.COLOR_BLUE_BUTTON;
beatmap = beatmapSet.get(beatmapIndex); beatmap = beatmapSet.get(beatmapIndex);

View File

@ -22,6 +22,7 @@ import itdelatrisu.opsu.GameData;
import itdelatrisu.opsu.GameData.HitObjectType; import itdelatrisu.opsu.GameData.HitObjectType;
import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.audio.SoundEffect;
@ -125,15 +126,17 @@ public class Spinner implements GameObject {
return; return;
boolean spinnerComplete = (rotations >= rotationsNeeded); boolean spinnerComplete = (rotations >= rotationsNeeded);
float alpha = Utils.clamp(1 - (float) timeDiff / FADE_IN_TIME, 0f, 1f);
// darken screen // darken screen
float alpha = Utils.clamp(1 - (float) timeDiff / FADE_IN_TIME, 0f, 1f); if (Options.getSkin().isSpinnerFadePlayfield()) {
float oldAlpha = Utils.COLOR_BLACK_ALPHA.a; float oldAlpha = Utils.COLOR_BLACK_ALPHA.a;
if (timeDiff > 0) if (timeDiff > 0)
Utils.COLOR_BLACK_ALPHA.a *= alpha; Utils.COLOR_BLACK_ALPHA.a *= alpha;
g.setColor(Utils.COLOR_BLACK_ALPHA); g.setColor(Utils.COLOR_BLACK_ALPHA);
g.fillRect(0, 0, width, height); g.fillRect(0, 0, width, height);
Utils.COLOR_BLACK_ALPHA.a = oldAlpha; Utils.COLOR_BLACK_ALPHA.a = oldAlpha;
}
// rpm // rpm
int rpm = Math.abs(Math.round(sumVelocity / storedVelocities.length * 60)); int rpm = Math.abs(Math.round(sumVelocity / storedVelocities.length * 60));