From a2eaf356644573f410936eb5518e5f02ed513a4e Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Wed, 2 Sep 2015 23:10:31 -0500 Subject: [PATCH] Draw star rating stars in the song menu inside each song node. Star image was taken from XinCrin's "Fantasy's Skin". Signed-off-by: Jeffrey Han --- res/star.png | Bin 0 -> 6551 bytes src/itdelatrisu/opsu/GameImage.java | 6 +++ .../opsu/beatmap/BeatmapSetNode.java | 49 ++++++++++++++++-- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 res/star.png diff --git a/res/star.png b/res/star.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b06d991800bc43080650eed27ee7cfa1cfc6c8 GIT binary patch literal 6551 zcmV;I8EEE-P)|D^_ww@lRz|vCuzLs)$;-`! zo*{AqUjza0dRV*yaMRE;fKCVhpQKsoe1Yhg01=zBIT!& zC1$=TK@rP|Ibo3vKKm@PqnO#LJhq6%Ij6Hz*<$V$@wQAMN5qJ)hzm2hoGcOF60t^# zFqJFfH{#e-4l@G)6iI9sa9D{VHW4w29}?su;^hF~NC{tY+*d5%WDCTXa!E_i;d2ub z1#}&jF5T4HnnCyEWTkKf0>c0%E1Ah>(_PY1)0w;+02c53Su*0<(nUqKG_|(0G&D0Z z{i;y^b@OjZ+}lNZ8Th$p5Uu}MTtq^NHl z*T1?CO*}7&0ztZsv2j*bmJyf3G7=Z`5B*PvzoDiKdLpOAxi2$L0#SX*@cY_n(^h55xYX z#km%V()bZjV~l{*bt*u9?FT3d5g^g~#a;iSZ@&02Abxq_DwB(I|L-^bXThc7C4-yr zInE_0gw7K3GZ**7&k~>k0Z0NWkO#^@9q0fwx1%qjZ=)yBuQ3=5 z4Wo^*!gyjLF-e%Um=erBOdIALW)L%unZshS@>qSW9o8Sq#0s#5*edK%>{;v(b^`kb zN5rY%%y90wC>#%$kE_5P!JWYk;U;klcqzOl-UjcFXXA75rT9jCH~u<)0>40zCTJ7v z2qAyk54cquI@7b&LHdZ`+zlTss6bJ7%PQ)z$c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&# z>5aFg>%dv|BlF#7*y0wp`^=9lEkoT*H}*MRo91!mU`1M)F#pX@S{ZEzw)8f|^1;wV z$O~n^X4xCOyhe+sY1@y&)vVFt7J3PE&wpnGz{fwh^4=vM7t-n)`TA45_ILNK+sBtd zwnXX3KeT+_X-`LCKUU$bpr&P*%0yM`VQ6Doxev2UwUt-?v}Cm6R>sOcyyBd-rlZLQ zH7m5`7iqSPUy7Xg?BgpL{kfU`>wEX87mZ*4-d!s<*ZjYG{5L@otW|g4g?<14002ov JPDHLkV1n=0qpSb` literal 0 HcmV?d00001 diff --git a/src/itdelatrisu/opsu/GameImage.java b/src/itdelatrisu/opsu/GameImage.java index 798dc090..22e20f0e 100644 --- a/src/itdelatrisu/opsu/GameImage.java +++ b/src/itdelatrisu/opsu/GameImage.java @@ -292,6 +292,12 @@ public enum GameImage { MENU_BUTTON_MID ("button-middle", "png", false, false), MENU_BUTTON_LEFT ("button-left", "png", false, false), MENU_BUTTON_RIGHT ("button-right", "png", false, false), + STAR ("star", "png", false, false) { + @Override + protected Image process_sub(Image img, int w, int h) { + return img.getScaledCopy((MENU_BUTTON_BG.getImage().getHeight() * 0.16f) / img.getHeight()); + } + }, // Music Player Buttons MUSIC_PLAY ("music-play", "png", false, false), diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java b/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java index 3acbc850..80a09ce8 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java @@ -88,7 +88,7 @@ public class BeatmapSetNode { bg.draw(x, y, bgColor); float cx = x + (bg.getWidth() * 0.043f); - float cy = y + (bg.getHeight() * 0.2f) - 3; + float cy = y + (bg.getHeight() * 0.18f) - 3; // draw grade if (grade != Grade.NULL) { @@ -103,11 +103,54 @@ public class BeatmapSetNode { Fonts.loadGlyphs(Fonts.DEFAULT, beatmap.artistUnicode); } Fonts.MEDIUM.drawString(cx, cy, beatmap.getTitle(), textColor); - Fonts.DEFAULT.drawString(cx, cy + Fonts.MEDIUM.getLineHeight() - 2, + Fonts.DEFAULT.drawString(cx, cy + Fonts.MEDIUM.getLineHeight() - 3, String.format("%s // %s", beatmap.getArtist(), beatmap.creator), textColor); if (expanded || beatmapSet.size() == 1) - Fonts.BOLD.drawString(cx, cy + Fonts.MEDIUM.getLineHeight() + Fonts.DEFAULT.getLineHeight() - 4, + Fonts.BOLD.drawString(cx, cy + Fonts.MEDIUM.getLineHeight() + Fonts.DEFAULT.getLineHeight() - 6, beatmap.version, textColor); + + // draw stars + // (note: in osu!, stars are also drawn for beatmap sets of size 1) + if (expanded) { + if (beatmap.starRating >= 0) { + Image star = GameImage.STAR.getImage(); + float starOffset = star.getWidth() * 1.7f; + float starX = cx + starOffset * 0.04f; + float starY = cy + Fonts.MEDIUM.getLineHeight() + Fonts.DEFAULT.getLineHeight() * 2 - 10f * GameImage.getUIscale(); + float starCenterY = starY + star.getHeight() / 2f; + final float baseAlpha = focus ? 1f : 0.8f; + final float smallStarScale = 0.4f; + star.setAlpha(baseAlpha); + int i = 1; + for (; i < beatmap.starRating && i <= 5; i++) { + if (focus) + star.drawFlash(starX + (i - 1) * starOffset, starY, star.getWidth(), star.getHeight(), textColor); + else + star.draw(starX + (i - 1) * starOffset, starY); + } + if (i <= 5) { + float partialStarScale = smallStarScale + (float) (beatmap.starRating - i + 1) * (1f - smallStarScale); + Image partialStar = star.getScaledCopy(partialStarScale); + partialStar.setAlpha(baseAlpha); + float partialStarY = starCenterY - partialStar.getHeight() / 2f; + if (focus) + partialStar.drawFlash(starX + (i - 1) * starOffset, partialStarY, partialStar.getWidth(), partialStar.getHeight(), textColor); + else + partialStar.draw(starX + (i - 1) * starOffset, partialStarY); + } + if (++i <= 5) { + Image smallStar = star.getScaledCopy(smallStarScale); + smallStar.setAlpha(0.5f); + float smallStarY = starCenterY - smallStar.getHeight() / 2f; + for (; i <= 5; i++) { + if (focus) + smallStar.drawFlash(starX + (i - 1) * starOffset, smallStarY, smallStar.getWidth(), smallStar.getHeight(), textColor); + else + smallStar.draw(starX + (i - 1) * starOffset, smallStarY); + } + } + } + } } /**