mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Sprites/skins: Everything except deck editor icons now in a sprite, and fully accessed using skin enums. This includes foils, creatures, and all icons in game.
Skin enums sub-categorized to allow clearer access. Default coordinates added to skin enums, so declaration and positioning happen simultaneously (in one place). Removed old icons.
This commit is contained in:
@@ -531,7 +531,7 @@ public class ControlQuest {
|
||||
|
||||
Constant.Runtime.HUMAN_DECK[0] = currentDeck;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = event.getEventDeck();
|
||||
Constant.Quest.OPP_ICON_NAME[0] = event.getIcon();
|
||||
Constant.Quest.OPP_ICON_NAME[0] = event.getIconFilename();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -150,6 +150,9 @@ public class ControlSettings {
|
||||
|
||||
private void updateSkin() {
|
||||
String name = view.getLstChooseSkin().getSelectedValue().toString();
|
||||
Singletons.getView().getSkin().unloadSkin();
|
||||
Singletons.getView().setSkin(null);
|
||||
|
||||
FSkin skin = new FSkin(name);
|
||||
|
||||
skin.loadFontsAndImages();
|
||||
|
||||
@@ -41,8 +41,8 @@ public class QuestEvent {
|
||||
/** The difficulty. */
|
||||
private String difficulty = "Medium";
|
||||
|
||||
/** The icon. */
|
||||
private String icon = "Unknown.jpg";
|
||||
/** Filename of the icon for this event.*/
|
||||
private String iconFilename = "unknown";
|
||||
|
||||
/** The name. */
|
||||
private String name = "Noname";
|
||||
@@ -107,13 +107,13 @@ public class QuestEvent {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getIcon.
|
||||
* getIconFilename.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.String}.
|
||||
*/
|
||||
public final String getIcon() {
|
||||
return this.icon;
|
||||
public final String getIconFilename() {
|
||||
return this.iconFilename;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,12 +188,12 @@ public class QuestEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon.
|
||||
* Sets the icon filename.
|
||||
*
|
||||
* @param icon0
|
||||
* the icon to set
|
||||
* @param s0
|
||||
* filename of the icon to set
|
||||
*/
|
||||
public void setIcon(final String icon0) {
|
||||
this.icon = icon0;
|
||||
public void setIconFilename(final String s0) {
|
||||
this.iconFilename = s0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ public class QuestEventManager {
|
||||
} else if (key.equalsIgnoreCase("Description")) {
|
||||
qe.setDescription(value);
|
||||
} else if (key.equalsIgnoreCase("Icon")) {
|
||||
qe.setIcon(value);
|
||||
qe.setIconFilename(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestStallDefinition class.
|
||||
@@ -33,8 +35,8 @@ public class QuestStallDefinition {
|
||||
/** The display name. */
|
||||
private String displayName;
|
||||
|
||||
/** The icon name. */
|
||||
private String iconName;
|
||||
/** The icon.. */
|
||||
private ImageIcon icon;
|
||||
|
||||
/** The fluff. */
|
||||
private String fluff;
|
||||
@@ -50,14 +52,14 @@ public class QuestStallDefinition {
|
||||
* a {@link java.lang.String} object.
|
||||
* @param fluff
|
||||
* a {@link java.lang.String} object.
|
||||
* @param iconName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param i0
|
||||
* a {@link javax.swing.ImageIcon} object.
|
||||
*/
|
||||
public QuestStallDefinition(final String name, final String displayName, final String fluff, final String iconName) {
|
||||
public QuestStallDefinition(final String name, final String displayName, final String fluff, final ImageIcon i0) {
|
||||
this.setName(name);
|
||||
this.setDisplayName(displayName);
|
||||
this.setFluff(fluff);
|
||||
this.setIconName(iconName);
|
||||
this.setIcon(i0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,18 +86,18 @@ public class QuestStallDefinition {
|
||||
*
|
||||
* @return the iconName
|
||||
*/
|
||||
public String getIconName() {
|
||||
return this.iconName;
|
||||
public ImageIcon getIcon() {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon name.
|
||||
*
|
||||
* @param iconName0
|
||||
* @param i0
|
||||
* the iconName to set
|
||||
*/
|
||||
public void setIconName(final String iconName0) {
|
||||
this.iconName = iconName0;
|
||||
public void setIcon(final ImageIcon i0) {
|
||||
this.icon = i0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -47,24 +49,29 @@ public class QuestStallManager {
|
||||
* </p>
|
||||
*/
|
||||
public static void buildStalls() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
|
||||
QuestStallManager.stalls = new HashMap<String, QuestStallDefinition>();
|
||||
QuestStallManager.stalls.put(QuestStallManager.ALCHEMIST, new QuestStallDefinition(QuestStallManager.ALCHEMIST,
|
||||
"Alchemist", "The walls of this alchemist's stall are covered with shelves with potions, oils, "
|
||||
+ "powders, poultices and elixirs, each meticulously labeled.", "BottlesIconSmall.png"));
|
||||
+ "powders, poultices and elixirs, each meticulously labeled.",
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_BOTTLES)));
|
||||
QuestStallManager.stalls.put(QuestStallManager.BANKER, new QuestStallDefinition(QuestStallManager.BANKER,
|
||||
"Banker", "A large book large enough to be seen from the outside rests on the Banker's desk.",
|
||||
"CoinIconSmall.png"));
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_COIN)));
|
||||
QuestStallManager.stalls.put(QuestStallManager.BOOKSTORE, new QuestStallDefinition(QuestStallManager.BOOKSTORE,
|
||||
"Bookstore", "Tomes of different sizes are stacked in man-high towers.", "BookIconSmall.png"));
|
||||
"Bookstore", "Tomes of different sizes are stacked in man-high towers.",
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_BOOK)));
|
||||
QuestStallManager.stalls.put(QuestStallManager.GEAR, new QuestStallDefinition(QuestStallManager.GEAR,
|
||||
"Adventuring Gear",
|
||||
"This adventurer's market has a tool for every need ... or so the plaque on the wall claims.",
|
||||
"GearIconSmall.png"));
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_GEAR)));
|
||||
QuestStallManager.stalls.put(QuestStallManager.NURSERY, new QuestStallDefinition(QuestStallManager.NURSERY,
|
||||
"Nursery", "The smells of the one hundred and one different plants forms a unique fragrance.",
|
||||
"LeafIconSmall.png"));
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_LEAF)));
|
||||
QuestStallManager.stalls.put(QuestStallManager.PET_SHOP, new QuestStallDefinition(QuestStallManager.PET_SHOP,
|
||||
"Pet Shop", "This large stall echoes with a multitude of animal noises.", "FoxIconSmall.png"));
|
||||
"Pet Shop", "This large stall echoes with a multitude of animal noises.",
|
||||
skin.getIcon(FSkin.QuestIcons.ICO_FOX)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.quest.data.bazaar;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
* This interface defines a thing that can be sold at the Bazaar.
|
||||
*
|
||||
@@ -49,7 +51,7 @@ public interface QuestStallPurchasable extends Comparable<Object> {
|
||||
*
|
||||
* @return the name of the image that is displayed in the bazaar
|
||||
*/
|
||||
String getImageName();
|
||||
ImageIcon getIcon();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
|
||||
@@ -182,7 +184,7 @@ public abstract class QuestItemAbstract implements QuestStallPurchasable {
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
@Override
|
||||
public abstract String getImageName();
|
||||
public abstract ImageIcon getIcon();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* This item has special coding.
|
||||
@@ -45,8 +49,8 @@ public class QuestItemElixir extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "ElixirIcon.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_BOTTLES);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -47,8 +51,8 @@ public class QuestItemEstates extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "GoldIconLarge.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_GOLD);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -46,8 +50,8 @@ public class QuestItemLuckyCoin extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "CoinIcon.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_COIN);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -52,8 +56,8 @@ public class QuestItemMap extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "MapIconLarge.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_MAP);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -40,8 +44,8 @@ public class QuestItemSleight extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "BookIcon.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_BOOK);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
*/
|
||||
package forge.quest.data.item;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -59,8 +63,8 @@ public class QuestItemZeppelin extends QuestItemAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return "ZeppelinIcon.png";
|
||||
public final ImageIcon getIcon() {
|
||||
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_ZEP);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
@@ -96,7 +98,7 @@ public abstract class QuestPetAbstract implements QuestStallPurchasable {
|
||||
*
|
||||
* @return an array of {@link java.lang.String} objects.
|
||||
*/
|
||||
public abstract String[] getAllImageNames();
|
||||
public abstract ImageIcon[] getAllIcons();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -106,8 +108,8 @@ public abstract class QuestPetAbstract implements QuestStallPurchasable {
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
@Override
|
||||
public final String getImageName() {
|
||||
return this.getAllImageNames()[this.level];
|
||||
public final ImageIcon getIcon() {
|
||||
return this.getAllIcons()[this.level];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -101,8 +105,14 @@ public class QuestPetBird extends QuestPetAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String[] getAllImageNames() {
|
||||
return new String[] { "", "w_0_1_bird_pet_small.jpg", "w_1_1_bird_pet_small.jpg", "w_2_1_bird_pet_small.jpg",
|
||||
"w_2_1_bird_pet_first_strike_small.jpg" };
|
||||
public final ImageIcon[] getAllIcons() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
|
||||
return new ImageIcon[] {
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_BIRD1),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_BIRD2),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_BIRD3),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_BIRD4)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -97,8 +101,13 @@ public class QuestPetCrocodile extends QuestPetAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String[] getAllImageNames() {
|
||||
return new String[] { "", "b_1_1_crocodile_pet_small.jpg", "b_2_1_crocodile_pet_small.jpg",
|
||||
"b_3_1_crocodile_pet_small.jpg", "b_3_1_crocodile_pet_swampwalk_small.jpg" };
|
||||
public final ImageIcon[] getAllIcons() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
return new ImageIcon[] {
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_CROC1),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_CROC2),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_CROC3),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_CROC4)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.trigger.Trigger;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -113,8 +117,14 @@ public class QuestPetHound extends QuestPetAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String[] getAllImageNames() {
|
||||
return new String[] { "", "r_1_1_hound_pet_small.jpg", "r_1_1_hound_pet_haste_small.jpg",
|
||||
"r_2_1_hound_pet_small.jpg", "r_2_1_hound_pet_alone_small.jpg" };
|
||||
public final ImageIcon[] getAllIcons() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
|
||||
return new ImageIcon[] {
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_HOUND1),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_HOUND2),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_HOUND3),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_HOUND4)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,17 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -149,10 +153,17 @@ public class QuestPetPlant extends QuestPetAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String[] getAllImageNames() {
|
||||
return new String[] { "", "g_0_1_plant_wall_small.jpg", "g_0_2_plant_wall_small.jpg",
|
||||
"g_0_3_plant_wall_small.jpg", "g_1_3_plant_wall_small.jpg", "g_1_3_plant_wall_deathtouch_small",
|
||||
"g_1_4_plant_wall_small.jpg" };
|
||||
public final ImageIcon[] getAllIcons() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
|
||||
return new ImageIcon[] {
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT1),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT2),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT3),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT4),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT5),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_PLANT6)
|
||||
};
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
*/
|
||||
package forge.quest.data.pet;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -98,8 +102,13 @@ public class QuestPetWolf extends QuestPetAbstract {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final String[] getAllImageNames() {
|
||||
return new String[] { "", "g_1_1_wolf_pet_small.jpg", "g_1_2_wolf_pet_small.jpg", "g_2_2_wolf_pet_small.jpg",
|
||||
"g_2_2_wolf_pet_flanking_small.jpg" };
|
||||
public final ImageIcon[] getAllIcons() {
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
return new ImageIcon[] {
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_WOLF1),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_WOLF2),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_WOLF3),
|
||||
skin.getIcon(FSkin.CreatureIcons.ICO_WOLF4)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class QuestBazaarItem {
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
protected final JPanel getItemPanel() {
|
||||
ImageIcon icon = GuiUtils.getIconFromFile(this.item.getImageName());
|
||||
ImageIcon icon = this.item.getIcon();
|
||||
if (icon == null) {
|
||||
// The original size was only 40 x 40 pixels.
|
||||
// Increased the size to give added pixels for more detail.
|
||||
|
||||
@@ -35,7 +35,6 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.data.bazaar.QuestStallDefinition;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
@@ -71,32 +70,6 @@ public class QuestBazaarStall extends JPanel {
|
||||
/** The quest data. */
|
||||
private final QuestData questData = AllZone.getQuestData();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestBazaarStall.
|
||||
* </p>
|
||||
*
|
||||
* @wbp.parser.constructor
|
||||
*
|
||||
* @param name
|
||||
* a {@link java.lang.String} object.
|
||||
* @param stallName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param iconName
|
||||
* a {@link java.lang.String} object.
|
||||
* @param fluff
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
protected QuestBazaarStall(final String name, final String stallName, final String iconName, final String fluff) {
|
||||
this.name = name;
|
||||
this.fluff = fluff;
|
||||
this.icon = GuiUtils.getIconFromFile(iconName);
|
||||
this.stallName = stallName;
|
||||
|
||||
this.initUI();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestBazaarStall.
|
||||
@@ -107,7 +80,7 @@ public class QuestBazaarStall extends JPanel {
|
||||
*/
|
||||
protected QuestBazaarStall(final QuestStallDefinition definition) {
|
||||
this.fluff = definition.getFluff();
|
||||
this.icon = GuiUtils.getIconFromFile(definition.getIconName());
|
||||
this.icon = definition.getIcon();
|
||||
this.stallName = definition.getDisplayName();
|
||||
this.name = definition.getName();
|
||||
this.initUI();
|
||||
|
||||
@@ -31,10 +31,12 @@ import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestEvent;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -69,16 +71,17 @@ public class QuestSelectablePanel extends JPanel {
|
||||
*/
|
||||
public QuestSelectablePanel(final QuestEvent qe) {
|
||||
this.event = qe;
|
||||
this.iconfilename = qe.getIcon();
|
||||
this.iconfilename = qe.getIconFilename();
|
||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
||||
File file = new File(base, this.iconfilename);
|
||||
|
||||
final ImageIcon icon;
|
||||
if (!file.exists()) {
|
||||
file = new File(base, "Unknown.jpg");
|
||||
this.iconfilename = "Unknown.jpg";
|
||||
icon = Singletons.getView().getSkin().getIcon(FSkin.ForgeIcons.ICO_UNKNOWN);
|
||||
}
|
||||
else {
|
||||
icon = new ImageIcon(file.toString());
|
||||
}
|
||||
|
||||
final ImageIcon icon = new ImageIcon(file.toString());
|
||||
|
||||
this.backgroundColor = this.getBackground();
|
||||
this.setLayout(new BorderLayout(5, 5));
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge.view;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
@@ -41,6 +40,7 @@ import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.match.ViewField;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* Parent JFrame for Forge UI.
|
||||
@@ -50,6 +50,7 @@ import forge.view.toolbox.FOverlay;
|
||||
public class GuiTopLevel extends JFrame implements Display, CardContainer {
|
||||
private final JLayeredPane lpnContent;
|
||||
private final FControl control;
|
||||
private final FSkin skin;
|
||||
|
||||
/**
|
||||
* Parent JFrame for Forge UI.
|
||||
@@ -62,10 +63,11 @@ public class GuiTopLevel extends JFrame implements Display, CardContainer {
|
||||
|
||||
this.lpnContent = new JLayeredPane();
|
||||
this.lpnContent.setOpaque(true);
|
||||
this.skin = Singletons.getView().getSkin();
|
||||
this.setContentPane(this.lpnContent);
|
||||
this.addOverlay();
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setIconImage(Toolkit.getDefaultToolkit().getImage("res/images/symbols-13/favicon.png"));
|
||||
this.setIconImage(skin.getIcon(FSkin.ForgeIcons.ICO_FAVICON).getImage());
|
||||
this.setTitle("Forge: " + Singletons.getModel().getBuildInfo().getVersion());
|
||||
|
||||
// Init controller
|
||||
|
||||
@@ -157,7 +157,7 @@ public class HomeTopLevel extends FPanel {
|
||||
add(pnlMenu, "w 36%!, h 96%!, gap 2% 2% 2% 2%");
|
||||
add(pnlContent, "w 58%!, h 96%!, gap 0% 2% 2% 2%");
|
||||
|
||||
JLabel lblIcon = new JLabel(skin.getIcon(FSkin.ForgeIcons.IMG_LOGO));
|
||||
JLabel lblIcon = new JLabel(skin.getIcon(FSkin.ForgeIcons.ICO_LOGO));
|
||||
pnlMenu.add(lblIcon, "gapleft 10%, ax center");
|
||||
|
||||
constraints = "w 80%!, gapleft 10%, gaptop 1%, gapbottom 1%, h 40px!";
|
||||
|
||||
@@ -59,10 +59,10 @@ public class QuestFileLister extends JPanel {
|
||||
this.setOpaque(false);
|
||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||
|
||||
icoDelete = new ImageIcon("res/images/icons/DeleteIcon.png");
|
||||
icoDeleteOver = new ImageIcon("res/images/icons/DeleteIconOver.png");
|
||||
icoEdit = new ImageIcon("res/images/icons/EditIcon.png");
|
||||
icoEditOver = new ImageIcon("res/images/icons/EditIconOver.png");
|
||||
icoDelete = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE);
|
||||
icoDeleteOver = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER);
|
||||
icoEdit = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT);
|
||||
icoEditOver = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER);
|
||||
}
|
||||
|
||||
/** @param qd0   {@link forge.quest.data.QuestData}[] */
|
||||
@@ -77,7 +77,7 @@ public class QuestFileLister extends JPanel {
|
||||
rowTitle.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
rowTitle.add(new FLabel("Delete", SwingConstants.CENTER), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel("Edit", SwingConstants.CENTER), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel("Rename", SwingConstants.CENTER), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel("Name", SwingConstants.CENTER), "w 40%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel("Mode", SwingConstants.CENTER), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel("Record", SwingConstants.CENTER), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
|
||||
@@ -206,10 +206,10 @@ public class ViewQuest extends JScrollPane {
|
||||
pnlStats.setOpaque(false);
|
||||
pnlStats.setBorder(new MatteBorder(1, 0, 1, 0, clrBorders));
|
||||
|
||||
lblLife.setIcon(new ImageIcon("res/images/icons/Life.png"));
|
||||
lblCredits.setIcon(new ImageIcon("res/images/icons/CoinStack.png"));
|
||||
lblWins.setIcon(new ImageIcon("res/images/icons/IconPlus.png"));
|
||||
lblLosses.setIcon(new ImageIcon("res/images/icons/IconMinus.png"));
|
||||
lblLife.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_LIFE));
|
||||
lblCredits.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_COINSTACK));
|
||||
lblWins.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_PLUS));
|
||||
lblLosses.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_MINUS));
|
||||
lblNextChallengeInWins.setText("No challenges available.");
|
||||
btnBazaar.setToolTipText("Peruse the Bazaar");
|
||||
btnSpellShop.setToolTipText("Travel to the Spell Shop");
|
||||
@@ -514,15 +514,17 @@ public class ViewQuest extends JScrollPane {
|
||||
this.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
|
||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
||||
File file = new File(base, event.getIcon());
|
||||
File file = new File(base, event.getIconFilename());
|
||||
|
||||
if (!file.exists()) {
|
||||
file = new File(base, "Unknown.jpg");
|
||||
}
|
||||
|
||||
FLabel lblIcon = new FLabel(new ImageIcon(file.toString()));
|
||||
FLabel lblIcon = new FLabel();
|
||||
lblIcon.setIconScaleFactor(1);
|
||||
lblIcon.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
if (!file.exists()) {
|
||||
lblIcon.setIcon(skin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN));
|
||||
}
|
||||
else {
|
||||
lblIcon.setIcon(new ImageIcon(file.toString()));
|
||||
}
|
||||
this.add(lblIcon, "h 60px!, w 60px!, gap 10px 10px 10px 0, span 1 2");
|
||||
|
||||
// Name
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ViewField extends FRoundedPanel {
|
||||
|
||||
iiTemp = (f.exists()
|
||||
? new ImageIcon(filename)
|
||||
: new ImageIcon(ForgeProps.getFile(NewConstants.IMAGE_ICON) + File.separator + "Unknown.jpg"));
|
||||
: skin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN));
|
||||
|
||||
this.img = iiTemp.getImage();
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@ import java.awt.Image;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import arcane.ui.util.UI;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* CardFaceSymbols class.
|
||||
@@ -39,8 +40,6 @@ import com.esotericsoftware.minlog.Log;
|
||||
public class CardFaceSymbols {
|
||||
/** Constant <code>manaImages</code>. */
|
||||
private static final Map<String, Image> MANA_IMAGES = new HashMap<String, Image>();
|
||||
/** Constant <code>replaceSymbolsPattern</code>. */
|
||||
private static Pattern replaceSymbolsPattern = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -48,14 +47,75 @@ public class CardFaceSymbols {
|
||||
* </p>
|
||||
*/
|
||||
public static void loadImages() {
|
||||
String[] symbols = new String[] {"0", "1", "10", "11", "12", "15", "16", "2", "20", "2W", "2U", "2R", "2G",
|
||||
"2B", "3", "4", "5", "6", "7", "8", "9", "B", "BG", "BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T",
|
||||
"U", "UB", "UR", "W", "WB", "WU", "PW", "PU", "PB", "PR", "PG", "X", "Y", "Z", "slash", "attack",
|
||||
"defend", "summonsick", "phasing", "counters1", "counters2", "counters3", "countersMulti", "foil01",
|
||||
"foil02", "foil03", "foil04", "foil05", "foil06", "foil07", "foil08", "foil09", "foil10" };
|
||||
for (String symbol : symbols) {
|
||||
MANA_IMAGES.put(symbol, UI.getImageIcon("res/images/symbols-13/" + symbol + ".png").getImage());
|
||||
}
|
||||
final FSkin skin = Singletons.getView().getSkin();
|
||||
MANA_IMAGES.put("0", skin.getImage(FSkin.ColorlessManaIcons.ICO_0));
|
||||
MANA_IMAGES.put("1", skin.getImage(FSkin.ColorlessManaIcons.ICO_1));
|
||||
MANA_IMAGES.put("2", skin.getImage(FSkin.ColorlessManaIcons.ICO_2));
|
||||
MANA_IMAGES.put("3", skin.getImage(FSkin.ColorlessManaIcons.ICO_3));
|
||||
MANA_IMAGES.put("4", skin.getImage(FSkin.ColorlessManaIcons.ICO_4));
|
||||
MANA_IMAGES.put("5", skin.getImage(FSkin.ColorlessManaIcons.ICO_5));
|
||||
MANA_IMAGES.put("6", skin.getImage(FSkin.ColorlessManaIcons.ICO_6));
|
||||
MANA_IMAGES.put("7", skin.getImage(FSkin.ColorlessManaIcons.ICO_7));
|
||||
MANA_IMAGES.put("8", skin.getImage(FSkin.ColorlessManaIcons.ICO_8));
|
||||
MANA_IMAGES.put("9", skin.getImage(FSkin.ColorlessManaIcons.ICO_9));
|
||||
MANA_IMAGES.put("10", skin.getImage(FSkin.ColorlessManaIcons.ICO_10));
|
||||
MANA_IMAGES.put("11", skin.getImage(FSkin.ColorlessManaIcons.ICO_11));
|
||||
MANA_IMAGES.put("12", skin.getImage(FSkin.ColorlessManaIcons.ICO_12));
|
||||
MANA_IMAGES.put("15", skin.getImage(FSkin.ColorlessManaIcons.ICO_15));
|
||||
MANA_IMAGES.put("16", skin.getImage(FSkin.ColorlessManaIcons.ICO_16));
|
||||
MANA_IMAGES.put("20", skin.getImage(FSkin.ColorlessManaIcons.ICO_20));
|
||||
MANA_IMAGES.put("X", skin.getImage(FSkin.ColorlessManaIcons.ICO_X));
|
||||
MANA_IMAGES.put("Y", skin.getImage(FSkin.ColorlessManaIcons.ICO_Y));
|
||||
MANA_IMAGES.put("Z", skin.getImage(FSkin.ColorlessManaIcons.ICO_Z));
|
||||
|
||||
MANA_IMAGES.put("B", skin.getImage(FSkin.ManaIcons.ICO_BLACK));
|
||||
MANA_IMAGES.put("BG", skin.getImage(FSkin.ManaIcons.ICO_BLACK_GREEN));
|
||||
MANA_IMAGES.put("BR", skin.getImage(FSkin.ManaIcons.ICO_BLACK_RED));
|
||||
MANA_IMAGES.put("G", skin.getImage(FSkin.ManaIcons.ICO_GREEN));
|
||||
MANA_IMAGES.put("GU", skin.getImage(FSkin.ManaIcons.ICO_GREEN_BLUE));
|
||||
MANA_IMAGES.put("GW", skin.getImage(FSkin.ManaIcons.ICO_GREEN_WHITE));
|
||||
MANA_IMAGES.put("R", skin.getImage(FSkin.ManaIcons.ICO_RED));
|
||||
MANA_IMAGES.put("RG", skin.getImage(FSkin.ManaIcons.ICO_RED_GREEN));
|
||||
MANA_IMAGES.put("RW", skin.getImage(FSkin.ManaIcons.ICO_RED_WHITE));
|
||||
MANA_IMAGES.put("U", skin.getImage(FSkin.ManaIcons.ICO_BLUE));
|
||||
MANA_IMAGES.put("UB", skin.getImage(FSkin.ManaIcons.ICO_BLUE_BLACK));
|
||||
MANA_IMAGES.put("UR", skin.getImage(FSkin.ManaIcons.ICO_BLUE_RED));
|
||||
MANA_IMAGES.put("W", skin.getImage(FSkin.ManaIcons.ICO_WHITE));
|
||||
MANA_IMAGES.put("WB", skin.getImage(FSkin.ManaIcons.ICO_WHITE_BLACK));
|
||||
MANA_IMAGES.put("WU", skin.getImage(FSkin.ManaIcons.ICO_WHITE_BLUE));
|
||||
MANA_IMAGES.put("PW", skin.getImage(FSkin.ManaIcons.ICO_PHRYX_WHITE));
|
||||
MANA_IMAGES.put("PR", skin.getImage(FSkin.ManaIcons.ICO_PHRYX_RED));
|
||||
MANA_IMAGES.put("PU", skin.getImage(FSkin.ManaIcons.ICO_PHRYX_BLUE));
|
||||
MANA_IMAGES.put("PB", skin.getImage(FSkin.ManaIcons.ICO_PHRYX_BLACK));
|
||||
MANA_IMAGES.put("PG", skin.getImage(FSkin.ManaIcons.ICO_PHRYX_GREEN));
|
||||
MANA_IMAGES.put("2W", skin.getImage(FSkin.ManaIcons.ICO_2W));
|
||||
MANA_IMAGES.put("2U", skin.getImage(FSkin.ManaIcons.ICO_2U));
|
||||
MANA_IMAGES.put("2R", skin.getImage(FSkin.ManaIcons.ICO_2R));
|
||||
MANA_IMAGES.put("2G", skin.getImage(FSkin.ManaIcons.ICO_2G));
|
||||
MANA_IMAGES.put("2B", skin.getImage(FSkin.ManaIcons.ICO_2B));
|
||||
|
||||
MANA_IMAGES.put("S", skin.getImage(FSkin.GameplayIcons.ICO_SNOW));
|
||||
MANA_IMAGES.put("T", skin.getImage(FSkin.GameplayIcons.ICO_TAP));
|
||||
MANA_IMAGES.put("slash", skin.getImage(FSkin.GameplayIcons.ICO_SLASH));
|
||||
MANA_IMAGES.put("attack", skin.getImage(FSkin.GameplayIcons.ICO_ATTACK));
|
||||
MANA_IMAGES.put("defend", skin.getImage(FSkin.GameplayIcons.ICO_DEFEND));
|
||||
MANA_IMAGES.put("summonsick", skin.getImage(FSkin.GameplayIcons.ICO_SUMMONSICK));
|
||||
MANA_IMAGES.put("phasing", skin.getImage(FSkin.GameplayIcons.ICO_PHASING));
|
||||
MANA_IMAGES.put("counters1", skin.getImage(FSkin.GameplayIcons.ICO_COUNTERS1));
|
||||
MANA_IMAGES.put("counters2", skin.getImage(FSkin.GameplayIcons.ICO_COUNTERS2));
|
||||
MANA_IMAGES.put("counters3", skin.getImage(FSkin.GameplayIcons.ICO_COUNTERS3));
|
||||
MANA_IMAGES.put("countersMulti", skin.getImage(FSkin.GameplayIcons.ICO_COUNTERS_MULTI));
|
||||
|
||||
MANA_IMAGES.put("foil01", skin.getImage(FSkin.Foils.FOIL_01));
|
||||
MANA_IMAGES.put("foil02", skin.getImage(FSkin.Foils.FOIL_02));
|
||||
MANA_IMAGES.put("foil03", skin.getImage(FSkin.Foils.FOIL_03));
|
||||
MANA_IMAGES.put("foil04", skin.getImage(FSkin.Foils.FOIL_04));
|
||||
MANA_IMAGES.put("foil05", skin.getImage(FSkin.Foils.FOIL_05));
|
||||
MANA_IMAGES.put("foil06", skin.getImage(FSkin.Foils.FOIL_06));
|
||||
MANA_IMAGES.put("foil07", skin.getImage(FSkin.Foils.FOIL_07));
|
||||
MANA_IMAGES.put("foil08", skin.getImage(FSkin.Foils.FOIL_08));
|
||||
MANA_IMAGES.put("foil09", skin.getImage(FSkin.Foils.FOIL_09));
|
||||
MANA_IMAGES.put("foil10", skin.getImage(FSkin.Foils.FOIL_10));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,28 +236,4 @@ public class CardFaceSymbols {
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* replaceSymbolsWithHTML.
|
||||
* </p>
|
||||
*
|
||||
* @param value
|
||||
* a {@link java.lang.String} object.
|
||||
* @param small
|
||||
* a boolean.
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public static synchronized String replaceSymbolsWithHTML(String value, final boolean small) {
|
||||
if (small) {
|
||||
value = value.replace("{C}", "<img src='file:res/images/symbols-11/C.png' width=13 height=11>");
|
||||
return replaceSymbolsPattern.matcher(value).replaceAll(
|
||||
"<img src='file:res/images/symbols-11/$1$2.png' width=11 height=11>");
|
||||
} else {
|
||||
value = value.replace("{slash}", "<img src='file:res/images/symbols-13/slash.png' width=10 height=13>");
|
||||
value = value.replace("{C}", "<img src='file:res/images/symbols-13/C.png' width=16 height=13>");
|
||||
return replaceSymbolsPattern.matcher(value).replaceAll(
|
||||
"<img src='file:res/images/symbols-13/$1$2.png' width=13 height=13>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +77,10 @@ public class DeckLister extends JPanel {
|
||||
this.setOpaque(false);
|
||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||
|
||||
icoDelete = new ImageIcon("res/images/icons/DeleteIcon.png");
|
||||
icoDeleteOver = new ImageIcon("res/images/icons/DeleteIconOver.png");
|
||||
icoEdit = new ImageIcon("res/images/icons/EditIcon.png");
|
||||
icoEditOver = new ImageIcon("res/images/icons/EditIconOver.png");
|
||||
icoDelete = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE);
|
||||
icoDeleteOver = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER);
|
||||
icoEdit = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT);
|
||||
icoEditOver = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER);
|
||||
}
|
||||
|
||||
/** @param decks0 {@link forge.deck.Deck}[] */
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.view.toolbox;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
@@ -46,6 +47,13 @@ import forge.gui.GuiUtils;
|
||||
public class FSkin {
|
||||
/** Properties of various components that make up the skin. */
|
||||
public interface SkinProp { }
|
||||
/** Add this interface for sub-sprite components, storing their coords. */
|
||||
public interface Coords {
|
||||
/** */
|
||||
int[] COORDS = null;
|
||||
/** @return int[] */
|
||||
int[] getCoords();
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum Backgrounds implements SkinProp { /** */
|
||||
@@ -65,74 +73,268 @@ public class FSkin {
|
||||
CLR_TEXT, /** */
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ZoneIcons implements SkinProp { /** */
|
||||
ICO_HAND, /** */
|
||||
ICO_LIBRARY, /** */
|
||||
ICO_EXILE, /** */
|
||||
ICO_FLASHBACK, /** */
|
||||
ICO_GRAVEYARD, /** */
|
||||
ICO_POISON, /** */
|
||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||
public enum ZoneIcons implements SkinProp, Coords { /** */
|
||||
ICO_HAND (new int[] {280, 40, 40, 40}), /** */
|
||||
ICO_LIBRARY (new int[] {280, 0, 40, 40}), /** */
|
||||
ICO_EXILE (new int[] {320, 40, 40, 40}), /** */
|
||||
ICO_FLASHBACK (new int[] {280, 80, 40, 40}), /** */
|
||||
ICO_GRAVEYARD (new int[] {320, 0, 40, 40}), /** */
|
||||
ICO_POISON (new int[] {320, 80, 40, 40});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
ZoneIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ManaIcons implements SkinProp { /** */
|
||||
ICO_BLACK, /** */
|
||||
ICO_BLUE, /** */
|
||||
ICO_GREEN, /** */
|
||||
ICO_RED, /** */
|
||||
ICO_WHITE, /** */
|
||||
ICO_COLORLESS, /** */
|
||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||
public enum ManaIcons implements SkinProp, Coords { /** */
|
||||
ICO_BLACK (new int[] {360, 160, 40, 40, 13, 13}), /** */
|
||||
ICO_RED (new int[] {400, 160, 40, 40, 13, 13}), /** */
|
||||
ICO_COLORLESS (new int[] {440, 160, 40, 40, 13, 13}), /** */
|
||||
ICO_BLUE (new int[] {360, 200, 40, 40, 13, 13}), /** */
|
||||
ICO_GREEN (new int[] {400, 200, 40, 40, 13, 13}), /** */
|
||||
ICO_WHITE (new int[] {440, 200, 40, 40, 13, 13}), /** */
|
||||
ICO_2B (new int[] {360, 400, 40, 40, 13, 13}), /** */
|
||||
ICO_2G (new int[] {400, 400, 40, 40, 13, 13}), /** */
|
||||
ICO_2R (new int[] {440, 360, 40, 40, 13, 13}), /** */
|
||||
ICO_2U (new int[] {440, 360, 40, 40, 13, 13}), /** */
|
||||
ICO_2W (new int[] {400, 360, 40, 40, 13, 13}), /** */
|
||||
ICO_BLACK_GREEN (new int[] {360, 240, 40, 40, 13, 13}), /** */
|
||||
ICO_BLACK_RED (new int[] {400, 240, 40, 40, 13, 13}), /** */
|
||||
ICO_GREEN_BLUE (new int[] {360, 280, 40, 40, 13, 13}), /** */
|
||||
ICO_GREEN_WHITE (new int[] {440, 280, 40, 40, 13, 13}), /** */
|
||||
ICO_RED_GREEN (new int[] {360, 320, 40, 40, 13, 13}), /** */
|
||||
ICO_RED_WHITE (new int[] {400, 320, 40, 40, 13, 13}), /** */
|
||||
ICO_BLUE_BLACK (new int[] {440, 240, 40, 40, 13, 13}), /** */
|
||||
ICO_BLUE_RED (new int[] {440, 320, 40, 40, 13, 13}), /** */
|
||||
ICO_WHITE_BLACK (new int[] {400, 280, 40, 40, 13, 13}), /** */
|
||||
ICO_WHITE_BLUE (new int[] {360, 360, 40, 40, 13, 13}), /** */
|
||||
ICO_PHRYX_BLUE (new int[] {320, 200, 40, 40, 13, 13}), /** */
|
||||
ICO_PHRYX_WHITE (new int[] {320, 240, 40, 40, 13, 13}), /** */
|
||||
ICO_PHRYX_RED (new int[] {320, 280, 40, 40, 13, 13}), /** */
|
||||
ICO_PHRYX_GREEN (new int[] {320, 320, 40, 40, 13, 13}), /** */
|
||||
ICO_PHRYX_BLACK (new int[] {320, 360, 40, 40, 13, 13});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
ManaIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||
public enum ColorlessManaIcons implements SkinProp, Coords { /** */
|
||||
ICO_0 (new int[] {640, 200, 20, 20, 13, 13}), /** */
|
||||
ICO_1 (new int[] {660, 200, 20, 20, 13, 13}), /** */
|
||||
ICO_2 (new int[] {640, 220, 20, 20, 13, 13}), /** */
|
||||
ICO_3 (new int[] {660, 220, 20, 20, 13, 13}), /** */
|
||||
ICO_4 (new int[] {640, 240, 20, 20, 13, 13}), /** */
|
||||
ICO_5 (new int[] {660, 240, 20, 20, 13, 13}), /** */
|
||||
ICO_6 (new int[] {640, 260, 20, 20, 13, 13}), /** */
|
||||
ICO_7 (new int[] {660, 260, 20, 20, 13, 13}), /** */
|
||||
ICO_8 (new int[] {640, 280, 20, 20, 13, 13}), /** */
|
||||
ICO_9 (new int[] {660, 280, 20, 20, 13, 13}), /** */
|
||||
ICO_10 (new int[] {640, 300, 20, 20, 13, 13}), /** */
|
||||
ICO_11 (new int[] {660, 300, 20, 20, 13, 13}), /** */
|
||||
ICO_12 (new int[] {640, 320, 20, 20, 13, 13}), /** */
|
||||
ICO_15 (new int[] {660, 340, 20, 20, 13, 13}), /** */
|
||||
ICO_16 (new int[] {640, 360, 20, 20, 13, 13}), /** */
|
||||
ICO_20 (new int[] {640, 400, 20, 20, 13, 13}), /** */
|
||||
ICO_X (new int[] {640, 420, 20, 20, 13, 13}), /** */
|
||||
ICO_Y (new int[] {660, 420, 20, 20, 13, 13}), /** */
|
||||
ICO_Z (new int[] {640, 440, 20, 20, 13, 13});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
ColorlessManaIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||
public enum GameplayIcons implements SkinProp, Coords { /** */
|
||||
ICO_SNOW (new int[] {320, 160, 40, 40}), /** */
|
||||
ICO_TAP (new int[] {660, 440, 20, 20}), /** */
|
||||
ICO_UNTAP (new int[] {640, 460, 20, 20}), /** */
|
||||
ICO_SLASH (new int[] {660, 400, 10, 13}), /** */
|
||||
ICO_ATTACK (new int[] {160, 320, 80, 80, 32, 32}), /** */
|
||||
ICO_DEFEND (new int[] {160, 400, 80, 80, 32, 32}), /** */
|
||||
ICO_SUMMONSICK (new int[] {240, 400, 80, 80, 32, 32}), /** */
|
||||
ICO_PHASING (new int[] {240, 320, 80, 80, 32, 32}), /** */
|
||||
ICO_COUNTERS1 (new int[] {0, 320, 80, 80}), /** */
|
||||
ICO_COUNTERS2 (new int[] {0, 400, 80, 80}), /** */
|
||||
ICO_COUNTERS3 (new int[] {80, 320, 80, 80}), /** */
|
||||
ICO_COUNTERS_MULTI (new int[] {80, 400, 80, 80});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
GameplayIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum DockIcons implements SkinProp { /** */
|
||||
ICO_SHORTCUTS, /** */
|
||||
ICO_SETTINGS, /** */
|
||||
ICO_ENDTURN, /** */
|
||||
ICO_CONCEDE, /** */
|
||||
ICO_DECKLIST, /** */
|
||||
public enum Foils implements SkinProp, Coords { /** */
|
||||
FOIL_01 (new int[] {0, 0, 400, 570}), /** */
|
||||
FOIL_02 (new int[] {400, 0, 400, 570}), /** */
|
||||
FOIL_03 (new int[] {0, 570, 400, 570}), /** */
|
||||
FOIL_04 (new int[] {400, 570, 400, 570}), /** */
|
||||
FOIL_05 (new int[] {0, 1140, 400, 570}), /** */
|
||||
FOIL_06 (new int[] {400, 1140, 400, 570}), /** */
|
||||
FOIL_07 (new int[] {0, 1710, 400, 570}), /** */
|
||||
FOIL_08 (new int[] {400, 1710, 400, 570}), /** */
|
||||
FOIL_09 (new int[] {0, 2280, 400, 570}), /** */
|
||||
FOIL_10 (new int[] {400, 2280, 400, 570});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
Foils(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ForgeIcons implements SkinProp { /** */
|
||||
IMG_LOGO, /** */
|
||||
IMG_FAVICON, /** */
|
||||
public enum DockIcons implements SkinProp, Coords { /** */
|
||||
ICO_SHORTCUTS (new int[] {160, 640, 80, 80}), /** */
|
||||
ICO_SETTINGS (new int[] {80, 640, 80, 80}), /** */
|
||||
ICO_ENDTURN (new int[] {320, 640, 80, 80}), /** */
|
||||
ICO_CONCEDE (new int[] {240, 640, 80, 80}), /** */
|
||||
ICO_DECKLIST (new int[] {400, 640, 80, 80});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
DockIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ButtonImages implements SkinProp { /** */
|
||||
IMG_BTN_START_UP, /** */
|
||||
IMG_BTN_START_OVER, /** */
|
||||
IMG_BTN_START_DOWN, /** */
|
||||
public enum QuestIcons implements SkinProp, Coords { /** */
|
||||
ICO_ZEP (new int[] {0, 480, 80, 80}), /** */
|
||||
ICO_GEAR (new int[] {80, 480, 80, 80}), /** */
|
||||
ICO_GOLD (new int[] {160, 480, 80, 80}), /** */
|
||||
ICO_BOOK (new int[] {240, 480, 80, 80}), /** */
|
||||
ICO_ELIXER (new int[] {320, 480, 80, 80}), /** */
|
||||
ICO_BOTTLES (new int[] {400, 480, 80, 80}), /** */
|
||||
ICO_BOX (new int[] {480, 480, 80, 80}), /** */
|
||||
ICO_COIN (new int[] {560, 480, 80, 80}), /** */
|
||||
|
||||
IMG_BTN_UP_LEFT, /** */
|
||||
IMG_BTN_UP_CENTER, /** */
|
||||
IMG_BTN_UP_RIGHT, /** */
|
||||
ICO_FOX (new int[] {0, 560, 80, 80}), /** */
|
||||
ICO_LEAF (new int[] {80, 560, 80, 80}), /** */
|
||||
ICO_LIFE (new int[] {160, 560, 80, 80}), /** */
|
||||
ICO_COINSTACK (new int[] {240, 560, 80, 80}), /** */
|
||||
ICO_MAP (new int[] {320, 560, 80, 80}), /** */
|
||||
ICO_NOTES (new int[] {400, 560, 80, 80}), /** */
|
||||
ICO_HEART (new int[] {480, 560, 80, 80}), /** */
|
||||
|
||||
IMG_BTN_OVER_LEFT, /** */
|
||||
IMG_BTN_OVER_CENTER, /** */
|
||||
IMG_BTN_OVER_RIGHT, /** */
|
||||
ICO_MINUS (new int[] {480, 640, 80, 80}), /** */
|
||||
ICO_PLUS (new int[] {560, 640, 80, 80});
|
||||
|
||||
IMG_BTN_DOWN_LEFT, /** */
|
||||
IMG_BTN_DOWN_CENTER, /** */
|
||||
IMG_BTN_DOWN_RIGHT, /** */
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
QuestIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
IMG_BTN_FOCUS_LEFT, /** */
|
||||
IMG_BTN_FOCUS_CENTER, /** */
|
||||
IMG_BTN_FOCUS_RIGHT, /** */
|
||||
/** */
|
||||
public enum CreatureIcons implements SkinProp, Coords { /** */
|
||||
ICO_BIRD1 (new int[] {0, 2280, 400, 570}), /** */
|
||||
ICO_BIRD2 (new int[] {400, 2280, 400, 570}), /** */
|
||||
ICO_BIRD3 (new int[] {800, 2280, 400, 570}), /** */
|
||||
ICO_BIRD4 (new int[] {1200, 2280, 400, 570}), /** */
|
||||
|
||||
IMG_BTN_TOGGLE_LEFT, /** */
|
||||
IMG_BTN_TOGGLE_CENTER, /** */
|
||||
IMG_BTN_TOGGLE_RIGHT, /** */
|
||||
ICO_PLANT1 (new int[] {0, 0, 400, 570}), /** */
|
||||
ICO_PLANT2 (new int[] {400, 0, 400, 570}), /** */
|
||||
ICO_PLANT3 (new int[] {800, 0, 400, 570}), /** */
|
||||
ICO_PLANT4 (new int[] {1200, 0, 400, 570}), /** */
|
||||
ICO_PLANT5 (new int[] {0, 570, 400, 570}), /** */
|
||||
ICO_PLANT6 (new int[] {400, 570, 400, 570}), /** */
|
||||
|
||||
IMG_BTN_DISABLED_LEFT, /** */
|
||||
IMG_BTN_DISABLED_CENTER, /** */
|
||||
IMG_BTN_DISABLED_RIGHT, /** */
|
||||
ICO_HOUND1 (new int[] {0, 1710, 400, 570}), /** */
|
||||
ICO_HOUND2 (new int[] {400, 1710, 400, 570}), /** */
|
||||
ICO_HOUND3 (new int[] {800, 1710, 400, 570}), /** */
|
||||
ICO_HOUND4 (new int[] {1200, 1710, 400, 570}), /** */
|
||||
|
||||
ICO_CROC1 (new int[] {0, 2850, 400, 570}), /** */
|
||||
ICO_CROC2 (new int[] {400, 2850, 400, 570}), /** */
|
||||
ICO_CROC3 (new int[] {800, 2850, 400, 570}), /** */
|
||||
ICO_CROC4 (new int[] {1200, 2850, 400, 570}), /** */
|
||||
|
||||
ICO_WOLF1 (new int[] {0, 1140, 400, 570}), /** */
|
||||
ICO_WOLF2 (new int[] {400, 1140, 400, 570}), /** */
|
||||
ICO_WOLF3 (new int[] {800, 1140, 400, 570}), /** */
|
||||
ICO_WOLF4 (new int[] {1200, 1140, 400, 570});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
CreatureIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ForgeIcons implements SkinProp, Coords { /** */
|
||||
ICO_EDIT (new int[] {640, 500, 20, 20}), /** */
|
||||
ICO_EDIT_OVER (new int[] {660, 500, 20, 20}), /** */
|
||||
ICO_DELETE (new int[] {640, 480, 20, 20}), /** */
|
||||
ICO_DELETE_OVER (new int[] {660, 480, 20, 20}), /** */
|
||||
ICO_UNKNOWN (new int[] {80, 720, 80, 80}), /** */
|
||||
ICO_LOGO (new int[] {480, 0, 200, 200}), /** */
|
||||
ICO_DEFAULT_MAGE (new int[] {0, 720, 80, 80}), /** */
|
||||
ICO_FAVICON (new int[] {0, 640, 80, 80});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
ForgeIcons(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum ButtonImages implements SkinProp, Coords { /** */
|
||||
IMG_BTN_START_UP (new int[] {480, 200, 160, 80}), /** */
|
||||
IMG_BTN_START_OVER (new int[] {480, 280, 160, 80}), /** */
|
||||
IMG_BTN_START_DOWN (new int[] {480, 360, 160, 80}), /** */
|
||||
|
||||
IMG_BTN_UP_LEFT (new int[] {80, 0, 40, 40}), /** */
|
||||
IMG_BTN_UP_CENTER (new int[] {120, 0, 1, 40}), /** */
|
||||
IMG_BTN_UP_RIGHT (new int[] {160, 0, 40, 40}), /** */
|
||||
|
||||
IMG_BTN_OVER_LEFT (new int[] {80, 40, 40, 40}), /** */
|
||||
IMG_BTN_OVER_CENTER (new int[] {120, 40, 1, 40}), /** */
|
||||
IMG_BTN_OVER_RIGHT (new int[] {160, 40, 40, 40}), /** */
|
||||
|
||||
IMG_BTN_DOWN_LEFT (new int[] {80, 80, 40, 40}), /** */
|
||||
IMG_BTN_DOWN_CENTER (new int[] {120, 80, 1, 40}), /** */
|
||||
IMG_BTN_DOWN_RIGHT (new int[] {160, 80, 40, 40}), /** */
|
||||
|
||||
IMG_BTN_FOCUS_LEFT (new int[] {80, 120, 40, 40}), /** */
|
||||
IMG_BTN_FOCUS_CENTER (new int[] {120, 120, 1, 40}), /** */
|
||||
IMG_BTN_FOCUS_RIGHT (new int[] {160, 120, 40, 40}), /** */
|
||||
|
||||
IMG_BTN_TOGGLE_LEFT (new int[] {80, 160, 40, 40}), /** */
|
||||
IMG_BTN_TOGGLE_CENTER (new int[] {120, 160, 1, 40}), /** */
|
||||
IMG_BTN_TOGGLE_RIGHT (new int[] {160, 160, 40, 40}), /** */
|
||||
|
||||
IMG_BTN_DISABLED_LEFT (new int[] {80, 200, 40, 40}), /** */
|
||||
IMG_BTN_DISABLED_CENTER (new int[] {120, 200, 1, 40}), /** */
|
||||
IMG_BTN_DISABLED_RIGHT (new int[] {160, 200, 40, 40});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
ButtonImages(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
private Map<SkinProp, ImageIcon> icons;
|
||||
private Map<SkinProp, Image> images;
|
||||
private Map<SkinProp, Color> colors;
|
||||
private Map<SkinProp, Image> foils;
|
||||
|
||||
private Map<Integer, Font> plainFonts;
|
||||
private Map<Integer, Font> boldFonts;
|
||||
@@ -140,7 +342,9 @@ public class FSkin {
|
||||
|
||||
private static final String
|
||||
FILE_SKINS_DIR = "res/images/skins/",
|
||||
FILE_SPRITE = "sprite.png",
|
||||
FILE_ICON_SPRITE = "sprite_icons.png",
|
||||
FILE_FOIL_SPRITE = "sprite_foils.png",
|
||||
FILE_CREATURE_SPRITE = "sprite_creatures.jpg",
|
||||
FILE_FONT = "font1.ttf",
|
||||
FILE_SPLASH = "bg_splash.png",
|
||||
FILE_MATCH_BG = "bg_match.jpg",
|
||||
@@ -151,8 +355,7 @@ public class FSkin {
|
||||
private final String defaultDir;
|
||||
private final String preferredName;
|
||||
private Font font;
|
||||
private BufferedImage bimDefaultSprite;
|
||||
private BufferedImage bimPreferredSprite;
|
||||
private BufferedImage bimDefaultSprite, bimPreferredSprite, bimFoils, bimCreatures;
|
||||
private int preferredH, preferredW;
|
||||
private FProgressBar barProgress;
|
||||
|
||||
@@ -176,7 +379,9 @@ public class FSkin {
|
||||
this.preferredDir = FILE_SKINS_DIR + preferredName + "/";
|
||||
this.defaultDir = FILE_SKINS_DIR + "default/";
|
||||
this.icons = new HashMap<SkinProp, ImageIcon>();
|
||||
this.images = new HashMap<SkinProp, Image>();
|
||||
this.colors = new HashMap<SkinProp, Color>();
|
||||
this.foils = new HashMap<SkinProp, Image>();
|
||||
|
||||
final File f = new File(preferredDir + FILE_SPLASH);
|
||||
final BufferedImage img;
|
||||
@@ -232,14 +437,19 @@ public class FSkin {
|
||||
|
||||
barProgress.setMaximum(57);
|
||||
|
||||
// Grab and test the two sprite files.
|
||||
final File f1 = new File(defaultDir + FILE_SPRITE);
|
||||
final File f2 = new File(preferredDir + FILE_SPRITE);
|
||||
// Grab and test various sprite files.
|
||||
final File f1 = new File(defaultDir + FILE_ICON_SPRITE);
|
||||
final File f2 = new File(preferredDir + FILE_ICON_SPRITE);
|
||||
final File f3 = new File(defaultDir + FILE_CREATURE_SPRITE);
|
||||
final File f4 = new File(defaultDir + FILE_FOIL_SPRITE);
|
||||
|
||||
try {
|
||||
bimDefaultSprite = ImageIO.read(f1);
|
||||
bimPreferredSprite = ImageIO.read(f2);
|
||||
|
||||
bimCreatures = ImageIO.read(f3);
|
||||
bimFoils = ImageIO.read(f4);
|
||||
|
||||
preferredH = bimPreferredSprite.getHeight();
|
||||
preferredW = bimPreferredSprite.getWidth();
|
||||
}
|
||||
@@ -279,91 +489,48 @@ public class FSkin {
|
||||
this.setIcon(Backgrounds.BG_TEXTURE, preferredDir + FILE_TEXTURE_BG);
|
||||
this.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG);
|
||||
|
||||
// Sprite
|
||||
final File file = new File(preferredDir + FILE_SPRITE);
|
||||
BufferedImage image;
|
||||
this.setColor(Colors.CLR_THEME, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 10)));
|
||||
this.setColor(Colors.CLR_BORDERS, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 30)));
|
||||
this.setColor(Colors.CLR_ZEBRA, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 50)));
|
||||
this.setColor(Colors.CLR_HOVER, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 70)));
|
||||
this.setColor(Colors.CLR_ACTIVE, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 90)));
|
||||
this.setColor(Colors.CLR_INACTIVE, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 110)));
|
||||
this.setColor(Colors.CLR_TEXT, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 130)));
|
||||
|
||||
try {
|
||||
image = ImageIO.read(file);
|
||||
// Run through enums and load their coords.
|
||||
for (ZoneIcons e : ZoneIcons.values()) { this.setIcon(e); }
|
||||
for (ManaIcons e : ManaIcons.values()) { this.setImage(e); }
|
||||
for (ColorlessManaIcons e : ColorlessManaIcons.values()) { this.setImage(e); }
|
||||
for (GameplayIcons e : GameplayIcons.values()) { this.setImage(e); }
|
||||
for (DockIcons e : DockIcons.values()) { this.setIcon(e); }
|
||||
for (ForgeIcons e : ForgeIcons.values()) { this.setIcon(e); }
|
||||
for (ButtonImages e : ButtonImages.values()) { this.setIcon(e); }
|
||||
for (QuestIcons e : QuestIcons.values()) { this.setIcon(e); }
|
||||
|
||||
this.setColor(Colors.CLR_THEME, this.getColorFromPixel(image.getRGB(70, 10)));
|
||||
this.setColor(Colors.CLR_BORDERS, this.getColorFromPixel(image.getRGB(70, 30)));
|
||||
this.setColor(Colors.CLR_ZEBRA, this.getColorFromPixel(image.getRGB(70, 50)));
|
||||
this.setColor(Colors.CLR_HOVER, this.getColorFromPixel(image.getRGB(70, 70)));
|
||||
this.setColor(Colors.CLR_ACTIVE, this.getColorFromPixel(image.getRGB(70, 90)));
|
||||
this.setColor(Colors.CLR_INACTIVE, this.getColorFromPixel(image.getRGB(70, 110)));
|
||||
this.setColor(Colors.CLR_TEXT, this.getColorFromPixel(image.getRGB(70, 130)));
|
||||
} catch (final IOException e) {
|
||||
System.err.println(this.notfound + preferredDir + FILE_SPRITE);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_LIBRARY, 280, 0, 40, 40);
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_HAND, 280, 40, 40, 40);
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_FLASHBACK, 280, 80, 40, 40);
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_GRAVEYARD, 320, 0, 40, 40);
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_EXILE, 320, 40, 40, 40);
|
||||
this.setIconAndIncrement(ZoneIcons.ICO_POISON, 320, 80, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ManaIcons.ICO_BLACK, 360, 160, 40, 40);
|
||||
this.setIconAndIncrement(ManaIcons.ICO_BLUE, 360, 200, 40, 40);
|
||||
this.setIconAndIncrement(ManaIcons.ICO_RED, 400, 160, 40, 40);
|
||||
this.setIconAndIncrement(ManaIcons.ICO_GREEN, 400, 200, 40, 40);
|
||||
this.setIconAndIncrement(ManaIcons.ICO_COLORLESS, 440, 160, 40, 40);
|
||||
this.setIconAndIncrement(ManaIcons.ICO_WHITE, 440, 200, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(DockIcons.ICO_SETTINGS, 80, 640, 80, 80);
|
||||
this.setIconAndIncrement(DockIcons.ICO_SHORTCUTS, 160, 640, 80, 80);
|
||||
this.setIconAndIncrement(DockIcons.ICO_CONCEDE, 240, 640, 80, 80);
|
||||
this.setIconAndIncrement(DockIcons.ICO_ENDTURN, 320, 640, 80, 80);
|
||||
this.setIconAndIncrement(DockIcons.ICO_DECKLIST, 400, 640, 80, 80);
|
||||
|
||||
this.setIconAndIncrement(ForgeIcons.IMG_LOGO, 480, 0, 200, 200);
|
||||
this.setIconAndIncrement(ForgeIcons.IMG_FAVICON, 0, 720, 80, 80);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_START_UP, 480, 200, 160, 80);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_START_OVER, 480, 280, 160, 80);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_START_DOWN, 480, 360, 160, 80);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_UP_LEFT, 80, 0, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_UP_CENTER, 120, 0, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_UP_RIGHT, 160, 0, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_OVER_LEFT, 80, 40, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_OVER_CENTER, 120, 40, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_OVER_RIGHT, 160, 40, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DOWN_LEFT, 80, 80, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DOWN_CENTER, 120, 80, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DOWN_RIGHT, 160, 80, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_FOCUS_LEFT, 80, 120, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_FOCUS_CENTER, 120, 120, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_FOCUS_RIGHT, 160, 120, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_TOGGLE_LEFT, 80, 160, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_TOGGLE_CENTER, 120, 160, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_TOGGLE_RIGHT, 160, 160, 40, 40);
|
||||
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DISABLED_LEFT, 80, 200, 40, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DISABLED_CENTER, 120, 200, 1, 40);
|
||||
this.setIconAndIncrement(ButtonImages.IMG_BTN_DISABLED_RIGHT, 160, 200, 40, 40);
|
||||
// Foils and creatures have a separate sprite, so use specific methods.
|
||||
for (Foils e : Foils.values()) { this.setFoil(e); }
|
||||
for (CreatureIcons e : CreatureIcons.values()) { this.setCreature(e); }
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getColorFromPixel.
|
||||
* </p>
|
||||
*
|
||||
* @param {@link java.lang.Integer} pixel information
|
||||
*/
|
||||
private Color getColorFromPixel(final int pixel) {
|
||||
int r, g, b, a;
|
||||
a = (pixel >> 24) & 0x000000ff;
|
||||
r = (pixel >> 16) & 0x000000ff;
|
||||
g = (pixel >> 8) & 0x000000ff;
|
||||
b = (pixel) & 0x000000ff;
|
||||
return new Color(r, g, b, a);
|
||||
/** (Should) clear memory resources for this skin object. */
|
||||
public void unloadSkin() {
|
||||
this.icons.clear();
|
||||
this.images.clear();
|
||||
this.colors.clear();
|
||||
this.foils.clear();
|
||||
this.plainFonts.clear();
|
||||
this.boldFonts.clear();
|
||||
this.italicFonts.clear();
|
||||
|
||||
this.bimCreatures.flush();
|
||||
this.bimDefaultSprite.flush();
|
||||
this.bimFoils.flush();
|
||||
this.bimPreferredSprite.flush();
|
||||
|
||||
this.bimCreatures = null;
|
||||
this.bimDefaultSprite = null;
|
||||
this.bimFoils = null;
|
||||
this.bimPreferredSprite = null;
|
||||
}
|
||||
|
||||
/** @return {@link java.awt.font} font */
|
||||
@@ -382,20 +549,6 @@ public class FSkin {
|
||||
return plainFonts.get(size);
|
||||
}
|
||||
|
||||
private void setFontAndIncrement(int size) {
|
||||
plainFonts.put(size, font.deriveFont(Font.PLAIN, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
private void setBoldFontAndIncrement(int size) {
|
||||
boldFonts.put(size, font.deriveFont(Font.BOLD, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
private void setItalicFontAndIncrement(int size) {
|
||||
italicFonts.put(size, font.deriveFont(Font.ITALIC, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
/**
|
||||
* @param size - integer, pixel size
|
||||
* @return {@link java.awt.font} font1
|
||||
@@ -428,9 +581,19 @@ public class FSkin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the icon.
|
||||
* Gets an image.
|
||||
*
|
||||
* @param s0   String address
|
||||
* @param s0   SkinProp enum
|
||||
* @return Image
|
||||
*/
|
||||
public Image getImage(final SkinProp s0) {
|
||||
return this.images.get(s0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an icon.
|
||||
*
|
||||
* @param s0   SkinProp enum
|
||||
* @return ImageIcon
|
||||
*/
|
||||
public ImageIcon getIcon(final SkinProp s0) {
|
||||
@@ -452,112 +615,21 @@ public class FSkin {
|
||||
w0 = (w0 < 1) ? 1 : w0;
|
||||
h0 = (h0 < 1) ? 1 : h0;
|
||||
|
||||
final BufferedImage original = (BufferedImage) this.icons.get(s0).getImage();
|
||||
final Image original =
|
||||
(this.icons.get(s0) == null
|
||||
? this.images.get(s0)
|
||||
: this.icons.get(s0).getImage());
|
||||
|
||||
final BufferedImage scaled = new BufferedImage(w0, h0, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
final 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.drawImage(original, 0, 0, w0, h0, 0, 0, original.getWidth(null), original.getHeight(null), null);
|
||||
g2d.dispose();
|
||||
|
||||
return new ImageIcon(scaled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an icon in this skin's icon map from a file address.
|
||||
* Throws IO exception for debugging if needed.
|
||||
*
|
||||
* @param s0
|
||||
*   Skin property (from enum)
|
||||
* @param s1
|
||||
*   File address
|
||||
*/
|
||||
private void setIcon(final SkinProp s0, final String s1) {
|
||||
try {
|
||||
final File file = new File(s1);
|
||||
ImageIO.read(file);
|
||||
} catch (IOException e) {
|
||||
System.err.println(this.notfound + preferredDir + FILE_SPLASH);
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.icons.put(s0, new ImageIcon(s1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the preferred sprite for existence of a sub-image
|
||||
* defined by X, Y, W, H.
|
||||
*
|
||||
* If an image is not present at those coordinates, default
|
||||
* icon is substituted.
|
||||
*
|
||||
* The result is saved in a HashMap.
|
||||
*
|
||||
* @param s0   An address in the hashmap, derived from SkinProp enum
|
||||
* @param x0   X-coord of sub-image
|
||||
* @param y0   Y-coord of sub-image
|
||||
* @param w0   Width of sub-image
|
||||
* @param h0   Height of sub-image
|
||||
*/
|
||||
private void setIconAndIncrement(final SkinProp s0,
|
||||
final int x0, final int y0, final int w0, final int h0) {
|
||||
// Test if requested sub-image in inside bounds of preferred sprite.
|
||||
// (Height and width of preferred sprite were set in loadFontAndImages.)
|
||||
Boolean exists = false;
|
||||
|
||||
if (x0 <= preferredW
|
||||
&& x0 + w0 <= preferredW
|
||||
&& y0 <= preferredH
|
||||
&& y0 + h0 <= preferredH) {
|
||||
exists = true;
|
||||
}
|
||||
|
||||
// Test if various points of requested sub-image are transparent.
|
||||
// If any return true, image exists.
|
||||
if (exists) {
|
||||
int x, y;
|
||||
Color c;
|
||||
exists = false;
|
||||
|
||||
// Center
|
||||
x = (int) (x0 + w0 / 2);
|
||||
y = (int) (y0 + h0 / 2);
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { exists = true; }
|
||||
|
||||
x += 2;
|
||||
y += 2;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { exists = true; }
|
||||
|
||||
x -= 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { exists = true; }
|
||||
|
||||
y -= 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { exists = true; }
|
||||
|
||||
x += 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { exists = true; }
|
||||
}
|
||||
|
||||
BufferedImage img = (exists ? bimPreferredSprite : bimDefaultSprite);
|
||||
BufferedImage bi0 = img.getSubimage(x0, y0, w0, h0);
|
||||
this.icons.put(s0, new ImageIcon(bi0));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an icon in this skin's icon map from a buffered image.
|
||||
*
|
||||
* @param s0   Skin property (from enum)
|
||||
* @param bi0   BufferedImage
|
||||
*/
|
||||
public void setIcon(final SkinProp s0, final BufferedImage bi0) {
|
||||
this.icons.put(s0, new ImageIcon(bi0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a color from this skin's color map.
|
||||
*
|
||||
@@ -568,18 +640,6 @@ public class FSkin {
|
||||
return this.colors.get(s0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a color in this skin's color map.
|
||||
*
|
||||
* @param s0
|
||||
*   Skin property (from enum)
|
||||
* @param c0
|
||||
*   Color
|
||||
*/
|
||||
public void setColor(final SkinProp s0, final Color c0) {
|
||||
this.colors.put(s0, c0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the skins.
|
||||
*
|
||||
@@ -602,4 +662,185 @@ public class FSkin {
|
||||
|
||||
return mySkins;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getColorFromPixel.
|
||||
* </p>
|
||||
*
|
||||
* @param {@link java.lang.Integer} pixel information
|
||||
*/
|
||||
private Color getColorFromPixel(final int pixel) {
|
||||
int r, g, b, a;
|
||||
a = (pixel >> 24) & 0x000000ff;
|
||||
r = (pixel >> 16) & 0x000000ff;
|
||||
g = (pixel >> 8) & 0x000000ff;
|
||||
b = (pixel) & 0x000000ff;
|
||||
return new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
private BufferedImage testPreferredSprite(SkinProp s0) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
int w0 = coords[2];
|
||||
int h0 = coords[3];
|
||||
|
||||
// Test if requested sub-image in inside bounds of preferred sprite.
|
||||
// (Height and width of preferred sprite were set in loadFontAndImages.)
|
||||
if (x0 > preferredW || x0 + w0 > preferredW
|
||||
|| y0 > preferredH || y0 + h0 > preferredH) {
|
||||
return bimDefaultSprite;
|
||||
}
|
||||
|
||||
// Test if various points of requested sub-image are transparent.
|
||||
// If any return true, image exists.
|
||||
int x = 0, y = 0;
|
||||
Color c;
|
||||
|
||||
// Center
|
||||
x = (int) (x0 + w0 / 2);
|
||||
y = (int) (y0 + h0 / 2);
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { return bimPreferredSprite; }
|
||||
|
||||
x += 2;
|
||||
y += 2;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { return bimPreferredSprite; }
|
||||
|
||||
x -= 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { return bimPreferredSprite; }
|
||||
|
||||
y -= 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { return bimPreferredSprite; }
|
||||
|
||||
x += 4;
|
||||
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
|
||||
if (c.getAlpha() != 0) { return bimPreferredSprite; }
|
||||
|
||||
return bimDefaultSprite;
|
||||
}
|
||||
|
||||
private void setFoil(final SkinProp s0) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
int w0 = coords[2];
|
||||
int h0 = coords[3];
|
||||
|
||||
this.foils.put(s0, bimFoils.getSubimage(x0, y0, w0, h0));
|
||||
}
|
||||
|
||||
private void setCreature(final SkinProp s0) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
int w0 = coords[2];
|
||||
int h0 = coords[3];
|
||||
|
||||
this.icons.put(s0, new ImageIcon(bimCreatures.getSubimage(x0, y0, w0, h0)));
|
||||
}
|
||||
|
||||
private void setColor(final SkinProp s0, final Color c0) {
|
||||
this.colors.put(s0, c0);
|
||||
}
|
||||
|
||||
private void setFontAndIncrement(int size) {
|
||||
plainFonts.put(size, font.deriveFont(Font.PLAIN, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
private void setBoldFontAndIncrement(int size) {
|
||||
boldFonts.put(size, font.deriveFont(Font.BOLD, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
private void setItalicFontAndIncrement(int size) {
|
||||
italicFonts.put(size, font.deriveFont(Font.ITALIC, size));
|
||||
if (barProgress != null) { barProgress.increment(); }
|
||||
}
|
||||
|
||||
private void setIcon(final SkinProp s0) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
int w0 = coords[2];
|
||||
int h0 = coords[3];
|
||||
|
||||
BufferedImage img = testPreferredSprite(s0);
|
||||
this.icons.put(s0, new ImageIcon(img.getSubimage(x0, y0, w0, h0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an icon in this skin's icon map from a file address.
|
||||
* Throws IO exception for debugging if needed.
|
||||
*
|
||||
* @param s0
|
||||
*   Skin property (from enum)
|
||||
* @param s1
|
||||
*   File address
|
||||
*/
|
||||
private void setIcon(final SkinProp s0, final String s1) {
|
||||
try {
|
||||
final File file = new File(s1);
|
||||
ImageIO.read(file);
|
||||
} catch (IOException e) {
|
||||
System.err.println(this.notfound + preferredDir + FILE_SPLASH);
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.icons.put(s0, new ImageIcon(s1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an icon in this skin's icon map from a buffered image.
|
||||
*
|
||||
* @param s0   Skin property (from enum)
|
||||
* @param bi0   BufferedImage
|
||||
*/
|
||||
private void setIcon(final SkinProp s0, final BufferedImage bi0) {
|
||||
this.icons.put(s0, new ImageIcon(bi0));
|
||||
}
|
||||
|
||||
/**
|
||||
* setImage, with auto-scaling assumed true.
|
||||
*
|
||||
* @param s0
|
||||
*/
|
||||
private void setImage(final SkinProp s0) {
|
||||
setImage(s0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the preferred sprite for existence of a sub-image
|
||||
* defined by X, Y, W, H.
|
||||
*
|
||||
* If an image is not present at those coordinates, default
|
||||
* icon is substituted.
|
||||
*
|
||||
* The result is saved in a HashMap.
|
||||
*
|
||||
* @param s0   An address in the hashmap, derived from SkinProp enum
|
||||
*/
|
||||
private void setImage(final SkinProp s0, boolean scale) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
int w0 = coords[2];
|
||||
int h0 = coords[3];
|
||||
int newW = (coords.length == 6 ? coords[4] : 0);
|
||||
int newH = (coords.length == 6 ? coords[5] : 0);
|
||||
|
||||
BufferedImage img = testPreferredSprite(s0);
|
||||
BufferedImage bi0 = img.getSubimage(x0, y0, w0, h0);
|
||||
|
||||
if (scale && newW != 0) {
|
||||
this.images.put(s0, bi0.getScaledInstance(newW, newH, Image.SCALE_AREA_AVERAGING));
|
||||
}
|
||||
else {
|
||||
this.images.put(s0, bi0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user