Fixed song scores getting clipped horizontally. (also from #131)

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-09-16 20:12:47 -04:00
parent 0278556947
commit 286388270e
2 changed files with 8 additions and 4 deletions

View File

@ -87,12 +87,16 @@ public class ScoreData implements Comparable<ScoreData> {
/** Drawing values. */
private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset, buttonAreaHeight;
/** The container width. */
private static int containerWidth;
/**
* Initializes the base coordinates for drawing.
* @param containerWidth the container width
* @param topY the top y coordinate
*/
public static void init(int containerWidth, float topY) {
ScoreData.containerWidth = containerWidth;
baseX = containerWidth * 0.01f;
baseY = topY;
buttonWidth = containerWidth * 0.4f;
@ -143,11 +147,11 @@ public class ScoreData implements Comparable<ScoreData> {
}
/**
* Sets a clip to the area.
* Sets a vertical clip to the area.
* @param g the graphics context
*/
public static void clipToDownloadArea(Graphics g) {
g.setClip((int) baseX, (int) baseY, (int) buttonWidth, (int) (buttonAreaHeight));
public static void clipToArea(Graphics g) {
g.setClip(0, (int) baseY, containerWidth, (int) buttonAreaHeight);
}
/**

View File

@ -417,7 +417,7 @@ public class SongMenu extends BasicGameState {
// score buttons
if (focusScores != null) {
ScoreData.clipToDownloadArea(g);
ScoreData.clipToArea(g);
int startScore = (int) (startScorePos.getPosition() / ScoreData.getButtonOffset());
int offset = (int) (-startScorePos.getPosition() + startScore * ScoreData.getButtonOffset());