Small follow-up to 70c70fd.

- Page back/forward are now expanding buttons instead of static images.
- Fixed a mistake in DownloadList.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-02-01 02:53:01 -05:00
parent 70c70fd812
commit cfc0449ab2
3 changed files with 42 additions and 53 deletions

View File

@@ -18,6 +18,8 @@
package itdelatrisu.opsu.downloads;
import itdelatrisu.opsu.ErrorHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -26,8 +28,6 @@ import java.util.Map;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import org.newdawn.slick.util.Log;
/**
* Maintains the current downloads list.
*/
@@ -134,7 +134,7 @@ public class DownloadList {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
Log.error("Could not set system look and feel for Container.", e);
ErrorHandler.error("Could not set system look and feel for DownloadList.", e, true);
}
int n = JOptionPane.showConfirmDialog(null,
"Beatmap downloads are in progress.\nAre you sure you want to quit opsu!?",

View File

@@ -155,30 +155,6 @@ public class DownloadNode {
(cy > infoBaseY && cy < infoBaseY + infoHeight * DownloadsMenu.MAX_DOWNLOADS_SHOWN));
}
/**
* Returns true if the coordinates are within the bounds of the
* previous page icon.
* @param cx the x coordinate
* @param cy the y coordinate
*/
public static boolean prevPageContains(float cx, float cy) {
Image img = GameImage.MUSIC_PREVIOUS.getImage();
return ((cx > buttonBaseX && cx < buttonBaseX + img.getWidth()) &&
(cy > buttonBaseY - img.getHeight() && cy < buttonBaseY));
}
/**
* Returns true if the coordinates are within the bounds of the
* next page icon.
* @param cx the x coordinate
* @param cy the y coordinate
*/
public static boolean nextPageContains(float cx, float cy) {
Image img = GameImage.MUSIC_NEXT.getImage();
return ((cx > buttonBaseX + buttonWidth - img.getWidth() && cx < buttonBaseX + buttonWidth) &&
(cy > buttonBaseY - img.getHeight() && cy < buttonBaseY));
}
/**
* Draws the scroll bar for the download result buttons.
* @param g the graphics context
@@ -215,27 +191,6 @@ public class DownloadNode {
g.fillRect(infoBaseX + infoWidth - scrollbarWidth, infoBaseY + offsetY, scrollbarWidth, scrollbarHeight);
}
/**
* Draws the page number text and previous/next page icons.
* @param page the current page number
* @param prev whether to draw the previous page icon
* @param next whether to draw the next page icon
*/
public static void drawPageIcons(int page, boolean prev, boolean next) {
String pageText = String.format("Page %d", page);
Utils.FONT_BOLD.drawString(
buttonBaseX + (buttonWidth - Utils.FONT_BOLD.getWidth("Page 1")) / 2f,
buttonBaseY - Utils.FONT_BOLD.getLineHeight() * 1.3f, pageText, Color.white);
if (prev) {
Image prevImg = GameImage.MUSIC_PREVIOUS.getImage();
prevImg.draw(buttonBaseX, buttonBaseY - prevImg.getHeight());
}
if (next) {
Image nextImg = GameImage.MUSIC_NEXT.getImage();
nextImg.draw(buttonBaseX + buttonWidth - nextImg.getWidth(), buttonBaseY - nextImg.getHeight());
}
}
/**
* Constructor.
*/