mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Added mana icon versions to each skin.
Renamed texture1.jpg to bg_texture.jpg. Removed old icon versions. Added icon and font resize adapters to all pool labels.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 61 KiB |
@@ -242,53 +242,52 @@ public class ViewField extends FRoundedPanel {
|
|||||||
final String constraintsR = "w 47%!, h 12.5%!, growy, gapright 3%";
|
final String constraintsR = "w 47%!, h 12.5%!, growy, gapright 3%";
|
||||||
|
|
||||||
// Hand, library, graveyard, exile, flashback, poison labels
|
// Hand, library, graveyard, exile, flashback, poison labels
|
||||||
ViewField.this.lblHand = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_hand.png"), "99");
|
ViewField.this.lblHand = new DetailLabel("zone.hand", "99");
|
||||||
ViewField.this.lblHand.setToolTipText("Cards in hand");
|
ViewField.this.lblHand.setToolTipText("Cards in hand");
|
||||||
poolArea.add(ViewField.this.lblHand, constraintsL);
|
poolArea.add(ViewField.this.lblHand, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblLibrary = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_library.png"), "99");
|
ViewField.this.lblLibrary = new DetailLabel("zone.library", "99");
|
||||||
ViewField.this.lblLibrary.setToolTipText("Cards in library");
|
ViewField.this.lblLibrary.setToolTipText("Cards in library");
|
||||||
poolArea.add(ViewField.this.lblLibrary, constraintsR);
|
poolArea.add(ViewField.this.lblLibrary, constraintsR);
|
||||||
|
|
||||||
ViewField.this.lblGraveyard = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_grave.png"), "99");
|
ViewField.this.lblGraveyard = new DetailLabel("zone.graveyard", "99");
|
||||||
ViewField.this.lblGraveyard.setToolTipText("Cards in graveyard");
|
ViewField.this.lblGraveyard.setToolTipText("Cards in graveyard");
|
||||||
poolArea.add(ViewField.this.lblGraveyard, constraintsL);
|
poolArea.add(ViewField.this.lblGraveyard, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblExile = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_exile.png"), "99");
|
ViewField.this.lblExile = new DetailLabel("zone.exile", "99");
|
||||||
ViewField.this.lblExile.setToolTipText("Exiled cards");
|
ViewField.this.lblExile.setToolTipText("Exiled cards");
|
||||||
poolArea.add(ViewField.this.lblExile, constraintsR);
|
poolArea.add(ViewField.this.lblExile, constraintsR);
|
||||||
|
|
||||||
ViewField.this.lblFlashback = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_flashback.png"),
|
ViewField.this.lblFlashback = new DetailLabel("zone.flashback", "99");
|
||||||
"99");
|
|
||||||
ViewField.this.lblFlashback.setToolTipText("Flashback cards");
|
ViewField.this.lblFlashback.setToolTipText("Flashback cards");
|
||||||
poolArea.add(ViewField.this.lblFlashback, constraintsL);
|
poolArea.add(ViewField.this.lblFlashback, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblPoison = new DetailLabel(new ImageIcon("res/images/symbols-13/detail_poison.png"), "99");
|
ViewField.this.lblPoison = new DetailLabel("zone.poison", "99");
|
||||||
ViewField.this.lblPoison.setToolTipText("Poison counters");
|
ViewField.this.lblPoison.setToolTipText("Poison counters");
|
||||||
poolArea.add(ViewField.this.lblPoison, constraintsR);
|
poolArea.add(ViewField.this.lblPoison, constraintsR);
|
||||||
|
|
||||||
// Black, Blue, Colorless, Green, Red, White mana labels
|
// Black, Blue, Colorless, Green, Red, White mana labels
|
||||||
ViewField.this.lblBlack = new DetailLabel(new ImageIcon("res/images/symbols-13/B.png"), "99");
|
ViewField.this.lblBlack = new DetailLabel("mana.black", "99");
|
||||||
ViewField.this.lblBlack.setToolTipText("Black mana");
|
ViewField.this.lblBlack.setToolTipText("Black mana");
|
||||||
poolArea.add(ViewField.this.lblBlack, constraintsL);
|
poolArea.add(ViewField.this.lblBlack, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblBlue = new DetailLabel(new ImageIcon("res/images/symbols-13/U.png"), "99");
|
ViewField.this.lblBlue = new DetailLabel("mana.blue", "99");
|
||||||
ViewField.this.lblBlue.setToolTipText("Blue mana");
|
ViewField.this.lblBlue.setToolTipText("Blue mana");
|
||||||
poolArea.add(ViewField.this.lblBlue, constraintsR);
|
poolArea.add(ViewField.this.lblBlue, constraintsR);
|
||||||
|
|
||||||
ViewField.this.lblGreen = new DetailLabel(new ImageIcon("res/images/symbols-13/G.png"), "99");
|
ViewField.this.lblGreen = new DetailLabel("mana.green", "99");
|
||||||
ViewField.this.lblGreen.setToolTipText("Green mana");
|
ViewField.this.lblGreen.setToolTipText("Green mana");
|
||||||
poolArea.add(ViewField.this.lblGreen, constraintsL);
|
poolArea.add(ViewField.this.lblGreen, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblRed = new DetailLabel(new ImageIcon("res/images/symbols-13/R.png"), "99");
|
ViewField.this.lblRed = new DetailLabel("mana.red", "99");
|
||||||
ViewField.this.lblRed.setToolTipText("Red mana");
|
ViewField.this.lblRed.setToolTipText("Red mana");
|
||||||
poolArea.add(ViewField.this.lblRed, constraintsR);
|
poolArea.add(ViewField.this.lblRed, constraintsR);
|
||||||
|
|
||||||
ViewField.this.lblWhite = new DetailLabel(new ImageIcon("res/images/symbols-13/W.png"), "99");
|
ViewField.this.lblWhite = new DetailLabel("mana.white", "99");
|
||||||
ViewField.this.lblWhite.setToolTipText("White mana");
|
ViewField.this.lblWhite.setToolTipText("White mana");
|
||||||
poolArea.add(ViewField.this.lblWhite, constraintsL);
|
poolArea.add(ViewField.this.lblWhite, constraintsL);
|
||||||
|
|
||||||
ViewField.this.lblColorless = new DetailLabel(new ImageIcon("res/images/symbols-13/X.png"), "99");
|
ViewField.this.lblColorless = new DetailLabel("mana.colorless", "99");
|
||||||
ViewField.this.lblColorless.setToolTipText("Colorless mana");
|
ViewField.this.lblColorless.setToolTipText("Colorless mana");
|
||||||
poolArea.add(ViewField.this.lblColorless, constraintsR);
|
poolArea.add(ViewField.this.lblColorless, constraintsR);
|
||||||
}
|
}
|
||||||
@@ -628,21 +627,25 @@ public class ViewField extends FRoundedPanel {
|
|||||||
private final Color hoverBG;
|
private final Color hoverBG;
|
||||||
private Color clrBorders;
|
private Color clrBorders;
|
||||||
private final MouseAdapter madHover;
|
private final MouseAdapter madHover;
|
||||||
private int w, h;
|
private int w, h, padding;
|
||||||
|
private String iconAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of JLabel detailing info about field: has icon and optional
|
* Instance of JLabel detailing info about field: has icon and optional
|
||||||
* hover effect.
|
* hover effect.
|
||||||
*
|
*
|
||||||
* @param icon
|
* @param s0
|
||||||
*   Label's icon
|
*   Label's icon address
|
||||||
* @param txt
|
* @param txt0
|
||||||
*   Label's text
|
*   Label's text
|
||||||
*/
|
*/
|
||||||
public DetailLabel(final ImageIcon icon, final String txt) {
|
public DetailLabel(final String s0, final String txt0) {
|
||||||
super();
|
super();
|
||||||
this.setIcon(icon);
|
padding = 6;
|
||||||
this.setText(txt);
|
iconAddress = s0;
|
||||||
|
|
||||||
|
this.setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding));
|
||||||
|
this.setText(txt0);
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setForeground(ViewField.this.skin.getClrText());
|
this.setForeground(ViewField.this.skin.getClrText());
|
||||||
this.setPreferredSize(this.labelSize);
|
this.setPreferredSize(this.labelSize);
|
||||||
@@ -668,6 +671,7 @@ public class ViewField extends FRoundedPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
setFont(ViewField.this.skin.getFont1().deriveFont(Font.PLAIN, (getHeight() / 2)));
|
setFont(ViewField.this.skin.getFont1().deriveFont(Font.PLAIN, (getHeight() / 2)));
|
||||||
|
setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,13 @@ package forge.view.toolbox;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
@@ -35,6 +39,8 @@ import forge.gui.GuiUtils;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class FSkin {
|
public class FSkin {
|
||||||
|
private Map<String, BufferedImage> icons;
|
||||||
|
|
||||||
// ===== Public fields
|
// ===== Public fields
|
||||||
/** Primary font used in titles and buttons and most text output. */
|
/** Primary font used in titles and buttons and most text output. */
|
||||||
private Font font1 = null;
|
private Font font1 = null;
|
||||||
@@ -126,7 +132,7 @@ public class FSkin {
|
|||||||
// ===== Private fields
|
// ===== Private fields
|
||||||
private final String spriteFile = "sprite.png";
|
private final String spriteFile = "sprite.png";
|
||||||
private final String font1file = "font1.ttf";
|
private final String font1file = "font1.ttf";
|
||||||
private final String texture1file = "texture1.jpg";
|
private final String texture1file = "bg_texture.jpg";
|
||||||
private final String btnLupfile = "btnLup.png";
|
private final String btnLupfile = "btnLup.png";
|
||||||
private final String btnMupfile = "btnMup.png";
|
private final String btnMupfile = "btnMup.png";
|
||||||
private final String btnRupfile = "btnRup.png";
|
private final String btnRupfile = "btnRup.png";
|
||||||
@@ -174,6 +180,7 @@ public class FSkin {
|
|||||||
*/
|
*/
|
||||||
private void loadFontAndImages(final String skinName) {
|
private void loadFontAndImages(final String skinName) {
|
||||||
final String dirName = "res/images/skins/" + skinName + "/";
|
final String dirName = "res/images/skins/" + skinName + "/";
|
||||||
|
icons = new HashMap<String, BufferedImage>();
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
this.setFont1(this.retrieveFont(dirName + this.font1file));
|
this.setFont1(this.retrieveFont(dirName + this.font1file));
|
||||||
@@ -218,6 +225,22 @@ public class FSkin {
|
|||||||
this.setIconViewDeckList(image.getSubimage(60, 140, 20, 20));
|
this.setIconViewDeckList(image.getSubimage(60, 140, 20, 20));
|
||||||
this.setIconSettings(image.getSubimage(80, 0, 80, 80));
|
this.setIconSettings(image.getSubimage(80, 0, 80, 80));
|
||||||
this.setIconConcede(image.getSubimage(80, 80, 80, 80));
|
this.setIconConcede(image.getSubimage(80, 80, 80, 80));
|
||||||
|
|
||||||
|
// All icons should eventually be set and retrieved using this method.
|
||||||
|
// Doublestrike 6-12-11
|
||||||
|
this.setIcon("zone.hand", image.getSubimage(280, 40, 40, 40));
|
||||||
|
this.setIcon("zone.library", image.getSubimage(280, 0, 40, 40));
|
||||||
|
this.setIcon("zone.graveyard", image.getSubimage(320, 0, 40, 40));
|
||||||
|
this.setIcon("zone.exile", image.getSubimage(320, 40, 40, 40));
|
||||||
|
this.setIcon("zone.flashback", image.getSubimage(320, 120, 40, 40));
|
||||||
|
this.setIcon("zone.poison", image.getSubimage(320, 80, 40, 40));
|
||||||
|
|
||||||
|
this.setIcon("mana.black", image.getSubimage(240, 0, 40, 40));
|
||||||
|
this.setIcon("mana.blue", image.getSubimage(240, 40, 40, 40));
|
||||||
|
this.setIcon("mana.green", image.getSubimage(240, 120, 40, 40));
|
||||||
|
this.setIcon("mana.red", image.getSubimage(240, 80, 40, 40));
|
||||||
|
this.setIcon("mana.white", image.getSubimage(280, 120, 40, 40));
|
||||||
|
this.setIcon("mana.colorless", image.getSubimage(280, 80, 40, 40));
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
System.err.println(this.notfound + this.spriteFile);
|
System.err.println(this.notfound + this.spriteFile);
|
||||||
}
|
}
|
||||||
@@ -929,4 +952,43 @@ public class FSkin {
|
|||||||
public ImageIcon getIconViewDeckList() {
|
public ImageIcon getIconViewDeckList() {
|
||||||
return this.icoViewDeckList;
|
return this.icoViewDeckList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s0   String address
|
||||||
|
* @return ImageIcon
|
||||||
|
*/
|
||||||
|
public ImageIcon getIcon(String s0) {
|
||||||
|
return new ImageIcon(icons.get(s0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a scaled version of an icon from this skin's icon map.
|
||||||
|
*
|
||||||
|
* @param s0 String icon address
|
||||||
|
* @param w0 int new width
|
||||||
|
* @param h0 int new height
|
||||||
|
* @return ImageIcon
|
||||||
|
*/
|
||||||
|
public ImageIcon getIcon(String s0, int w0, int h0) {
|
||||||
|
w0 = (w0 < 1) ? 1 : w0;
|
||||||
|
h0 = (h0 < 1) ? 1 : h0;
|
||||||
|
|
||||||
|
BufferedImage original = icons.get(s0);
|
||||||
|
BufferedImage scaled = new BufferedImage(w0, h0, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
|
Graphics2D g2d = scaled.createGraphics();
|
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||||
|
g2d.drawImage(original, 0, 0, w0, h0, 0, 0, original.getWidth(), original.getHeight(), null);
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
return new ImageIcon(scaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param s0   String address
|
||||||
|
* @param bi0   BufferedImage
|
||||||
|
*/
|
||||||
|
public void setIcon(String s0, BufferedImage bi0) {
|
||||||
|
icons.put(s0, bi0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user