1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-06 17:00:12 -09:00
This commit is contained in:
magenoxx 2010-11-05 15:53:24 +00:00
parent c346276b0d
commit ad50277430
24 changed files with 220 additions and 85 deletions

View file

@ -42,6 +42,11 @@
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.9</version> <version>1.2.9</version>
</dependency> </dependency>
<dependency>
<groupId>com.mortennobel</groupId>
<artifactId>java-image-scaling</artifactId>
<version>0.8.4</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View file

@ -53,10 +53,14 @@ public class BigCard extends javax.swing.JPanel {
protected Image bigImage; protected Image bigImage;
protected UUID cardId; protected UUID cardId;
public BigCard() { public BigCard() {
initComponents(); initComponents();
} }
public void removeTextComponent() {
remove(this.scrollPane);
}
public void setCard(UUID cardId, Image image, List<String> strings) { public void setCard(UUID cardId, Image image, List<String> strings) {
if (this.cardId == null || !this.cardId.equals(cardId)) { if (this.cardId == null || !this.cardId.equals(cardId)) {
this.cardId = cardId; this.cardId = cardId;
@ -66,6 +70,10 @@ public class BigCard extends javax.swing.JPanel {
} }
} }
public UUID getCardId() {
return cardId;
}
private void drawText(java.util.List<String> strings) { private void drawText(java.util.List<String> strings) {
text.setText(""); text.setText("");
StyledDocument doc = text.getStyledDocument(); StyledDocument doc = text.getStyledDocument();

View file

@ -50,6 +50,7 @@ import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
@ -97,7 +98,7 @@ import mage.view.StackAbilityView;
public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener { public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
protected static Session session = MageFrame.getSession(); protected static Session session = MageFrame.getSession();
protected static DefaultActionCallback callback = new DefaultActionCallback(); protected static DefaultActionCallback callback = DefaultActionCallback.getInstance();
protected Point p; protected Point p;
protected CardDimensions dimension; protected CardDimensions dimension;
@ -469,4 +470,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
public void setCardBounds(int x, int y, int width, int height) { public void setCardBounds(int x, int y, int width, int height) {
throw new RuntimeException("Not implemented"); throw new RuntimeException("Not implemented");
} }
@Override
public Image getImage() {
return image;
}
} }

View file

@ -36,9 +36,14 @@ package mage.client.game;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener; import java.awt.event.ComponentListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.image.BufferedImage;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -49,11 +54,16 @@ import javax.swing.JComponent;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.client.MageFrame;
import mage.client.cards.BigCard; import mage.client.cards.BigCard;
import mage.client.cards.Card;
import mage.client.cards.Permanent; import mage.client.cards.Permanent;
import mage.client.plugins.adapters.MageMouseAdapter;
import mage.client.plugins.adapters.MageMouseMotionAdapter;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.Config; import mage.client.util.Config;
import mage.client.util.DefaultActionCallback; import mage.client.util.DefaultActionCallback;
import mage.client.util.ImageHelper;
import mage.view.PermanentView; import mage.view.PermanentView;
/** /**
@ -66,61 +76,32 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
private UUID gameId; private UUID gameId;
private BigCard bigCard; private BigCard bigCard;
private Map<String, JComponent> ui = new HashMap<String, JComponent>(); private Map<String, JComponent> ui = new HashMap<String, JComponent>();
//TODO: made it singleton protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
protected static DefaultActionCallback defaultCallback = new DefaultActionCallback();
/** Creates new form BattlefieldPanel */ /** Creates new form BattlefieldPanel */
public BattlefieldPanel(JScrollPane jScrollPane) { public BattlefieldPanel(JScrollPane jScrollPane) {
ui.put("jScrollPane", jScrollPane); ui.put("jScrollPane", jScrollPane);
ui.put("battlefieldPanel", this);
initComponents(); initComponents();
/*addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
int count = e.getClickCount();
//System.out.println("pressed");
if (count > 0) {
Object o = getComponentAt(e.getPoint());
//System.out.println("obj="+o);
//System.out.println("e: "+e.getX());
if (o instanceof MagePermanent) {
System.out.println("ok");
MagePermanent selectedCard = (MagePermanent) o;
//TODO: uncomment when attached cards works in plugin
/*
int x = e.getX() - selectedCard.getX();
int y = e.getY() - selectedCard.getY();
CardView card = selectedCard.getCardByPosition(x, y);
*/
/*defaultCallback.mouseClicked(e, gameId, MageFrame.getSession(), selectedCard.getOriginal());
}
}
}
}
@Override
public void mouseMoved(MouseEvent e) {
System.out.println("e: "+e.getX());
Object o = getComponentAt(e.getPoint());
if (o instanceof MagePermanent) {
MagePermanent card = (MagePermanent) o;
System.out.println("card: "+card.getOriginal().getId());
bigCard.setCard(card.getOriginal().getId(), null, card.getOriginal().getRules());
}
}
});*/
addMouseListener(new MageMouseAdapter(this, gameId));
addMouseMotionListener(new MageMouseMotionAdapter(this, bigCard));
} }
public void init(UUID gameId, BigCard bigCard) { public void init(UUID gameId, BigCard bigCard) {
this.gameId = gameId; this.gameId = gameId;
this.bigCard = bigCard; this.bigCard = bigCard;
if (Plugins.getInstance().isCardPluginLoaded()) {
bigCard.removeTextComponent();
}
} }
public void update(Map<UUID, PermanentView> battlefield) { public void update(Map<UUID, PermanentView> battlefield) {
for (PermanentView permanent: battlefield.values()) { for (PermanentView permanent: battlefield.values()) {
if (!permanents.containsKey(permanent.getId())) { if (!permanents.containsKey(permanent.getId())) {
//TODO: remove me
//System.out.println("Add permanent: " + permanent.getCardNumber());
addPermanent(permanent); addPermanent(permanent);
} }
else { else {

View file

@ -0,0 +1,45 @@
package mage.client.plugins.adapters;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.UUID;
import mage.cards.MagePermanent;
import mage.client.MageFrame;
import mage.client.plugins.impl.Plugins;
import mage.client.util.DefaultActionCallback;
public class MageMouseAdapter extends MouseAdapter {
private Component parent;
private UUID gameId;
protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
public MageMouseAdapter(Component parent, UUID gameId) {
this.parent = parent;
this.gameId = gameId;
}
@Override
public void mousePressed(MouseEvent e) {
if (!Plugins.getInstance().isCardPluginLoaded())
return;
if (e.getButton() == MouseEvent.BUTTON1) {
int count = e.getClickCount();
if (count > 0) {
Object o = parent.getComponentAt(e.getPoint());
if (o instanceof MagePermanent) {
MagePermanent selectedCard = (MagePermanent) o;
// TODO: uncomment when attached cards works in plugin
/*
* int x = e.getX() - selectedCard.getX(); int y = e.getY()
* - selectedCard.getY(); CardView card =
* selectedCard.getCardByPosition(x, y);
*/
defaultCallback.mouseClicked(e, gameId, MageFrame.getSession(), selectedCard.getOriginal());
}
}
}
}
}

View file

@ -0,0 +1,41 @@
package mage.client.plugins.adapters;
import java.awt.Component;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.image.BufferedImage;
import mage.cards.MagePermanent;
import mage.client.cards.BigCard;
import mage.client.plugins.impl.Plugins;
import mage.client.util.ImageHelper;
public class MageMouseMotionAdapter extends MouseMotionAdapter {
private Component parent;
private BigCard bigCard;
public MageMouseMotionAdapter(Component parent, BigCard bigCard) {
this.parent = parent;
this.bigCard = bigCard;
}
@Override
public void mouseMoved(MouseEvent e) {
if (!Plugins.getInstance().isCardPluginLoaded()) return;
Object o = parent.getComponentAt(e.getPoint());
if (o instanceof MagePermanent) {
MagePermanent card = (MagePermanent) o;
if (card.getOriginal().getId() != bigCard.getCardId()) {
Image image = card.getImage();
if (image != null && image instanceof BufferedImage) {
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth(), bigCard.getHeight());
bigCard.setCard(card.getOriginal().getId(), image, card.getOriginal().getRules());
} else {
//TODO: add description panel
}
}
}
}
}

View file

@ -1,6 +1,5 @@
package mage.client.plugins.impl; package mage.client.plugins.impl;
import java.awt.event.MouseEvent;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -12,12 +11,10 @@ import javax.swing.JComponent;
import mage.cards.CardDimensions; import mage.cards.CardDimensions;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.cards.interfaces.ActionCallback; import mage.cards.action.impl.EmptyCallback;
import mage.client.MageFrame;
import mage.client.cards.BigCard; import mage.client.cards.BigCard;
import mage.client.cards.Permanent; import mage.client.cards.Permanent;
import mage.client.plugins.MagePlugins; import mage.client.plugins.MagePlugins;
import mage.client.remote.Session;
import mage.client.util.Config; import mage.client.util.Config;
import mage.client.util.DefaultActionCallback; import mage.client.util.DefaultActionCallback;
import mage.constants.Constants; import mage.constants.Constants;
@ -36,7 +33,8 @@ public class Plugins implements MagePlugins {
private static PluginManager pm; private static PluginManager pm;
private final static Logger logger = Logging.getLogger(Plugins.class.getName()); private final static Logger logger = Logging.getLogger(Plugins.class.getName());
private CardPlugin cardPlugin = null; private CardPlugin cardPlugin = null;
protected static DefaultActionCallback defaultCallback = new DefaultActionCallback(); protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
private static final EmptyCallback emptyCallback = new EmptyCallback();
public static MagePlugins getInstance() { public static MagePlugins getInstance() {
return fINSTANCE; return fINSTANCE;
@ -68,16 +66,7 @@ public class Plugins implements MagePlugins {
@Override @Override
public MagePermanent getMagePermanent(final PermanentView card, BigCard bigCard, CardDimensions dimension, final UUID gameId) { public MagePermanent getMagePermanent(final PermanentView card, BigCard bigCard, CardDimensions dimension, final UUID gameId) {
if (cardPlugin != null) { if (cardPlugin != null) {
return cardPlugin.getMagePermanent(card, dimension, gameId, new ActionCallback() { return cardPlugin.getMagePermanent(card, dimension, gameId, emptyCallback);
@Override
public void mouseClicked(MouseEvent e) {
//defaultCallback.mouseClicked(e, gameId, MageFrame.getSession(), card);
}
@Override
public void mouseMoved(MouseEvent e) {
//defaultCallback.mouseClicked(e, gameId, MageFrame.getSession(), card);
}
});
} else { } else {
return new Permanent(card, bigCard, Config.dimensions, gameId); return new Permanent(card, bigCard, Config.dimensions, gameId);
} }

View file

@ -8,6 +8,15 @@ import mage.view.CardView;
public class DefaultActionCallback { public class DefaultActionCallback {
private static final DefaultActionCallback INSTANCE = new DefaultActionCallback();
private DefaultActionCallback() {}
public static DefaultActionCallback getInstance() {
return INSTANCE;
}
public void mouseClicked(MouseEvent e, UUID gameId, Session session, CardView card) { public void mouseClicked(MouseEvent e, UUID gameId, Session session, CardView card) {
System.out.println("gameId:" + gameId); System.out.println("gameId:" + gameId);
if (gameId != null) if (gameId != null)

View file

@ -52,6 +52,8 @@ import mage.view.AbilityView;
import mage.view.CardView; import mage.view.CardView;
import mage.view.StackAbilityView; import mage.view.StackAbilityView;
import com.mortennobel.imagescaling.ResampleOp;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -299,4 +301,14 @@ public class ImageHelper {
} }
} }
/**
* Returns an image scaled to the size appropriate for the card picture
* panel
*/
public static BufferedImage getResizedImage(BufferedImage original, int width, int height) {
ResampleOp resampleOp = new ResampleOp(width, height);
BufferedImage image = resampleOp.filter(original, null);
return image;
}
} }

Binary file not shown.

Before

(image error) Size: 3.6 KiB

View file

@ -1,13 +1,13 @@
package mage.cards; package mage.cards;
import java.awt.Image;
import java.util.List; import java.util.List;
import javax.swing.JPanel; import javax.swing.JPanel;
import mage.cards.interfaces.PermanentInterface;
import mage.view.PermanentView; import mage.view.PermanentView;
public abstract class MagePermanent extends JPanel implements PermanentInterface { public abstract class MagePermanent extends JPanel {
private static final long serialVersionUID = -3469258620601702171L; private static final long serialVersionUID = -3469258620601702171L;
abstract public List<MagePermanent> getLinks(); abstract public List<MagePermanent> getLinks();
@ -17,4 +17,6 @@ public abstract class MagePermanent extends JPanel implements PermanentInterface
abstract public void setAlpha(float transparency); abstract public void setAlpha(float transparency);
abstract public PermanentView getOriginal(); abstract public PermanentView getOriginal();
abstract public void setCardBounds(int x, int y, int width, int height); abstract public void setCardBounds(int x, int y, int width, int height);
abstract public void update(PermanentView card);
abstract public Image getImage();
} }

View file

@ -1,4 +1,4 @@
package mage.cards.interfaces; package mage.cards.action;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;

View file

@ -0,0 +1,22 @@
package mage.cards.action.impl;
import java.awt.event.MouseEvent;
import mage.cards.action.ActionCallback;
/**
* Callback that does nothing on any action
*
* @author nantuko84
*/
public class EmptyCallback implements ActionCallback {
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mouseMoved(MouseEvent e) {
}
}

View file

@ -1,7 +0,0 @@
package mage.cards.interfaces;
import mage.view.PermanentView;
public interface PermanentInterface {
void update(PermanentView card);
}

View file

@ -8,7 +8,7 @@ import javax.swing.JComponent;
import mage.cards.CardDimensions; import mage.cards.CardDimensions;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.cards.interfaces.ActionCallback; import mage.cards.action.ActionCallback;
import mage.view.PermanentView; import mage.view.PermanentView;
import net.xeoh.plugins.base.Plugin; import net.xeoh.plugins.base.Plugin;

View file

@ -96,6 +96,8 @@ public class CardView implements Serializable {
this.rarity = card.getRarity(); this.rarity = card.getRarity();
this.expansionSetCode = card.getExpansionSetCode(); this.expansionSetCode = card.getExpansionSetCode();
} }
//TODO:remove me
//System.out.println("**** CARD NUMBER **** : " + card.getCardNumber() + " : " + card.getName() + " : " + card.getExpansionSetCode());
this.cardNumber = card.getCardNumber(); this.cardNumber = card.getCardNumber();
if (card instanceof Spell) { if (card instanceof Spell) {

View file

@ -31,6 +31,7 @@
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.9</version> <version>1.2.9</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -10,9 +10,6 @@ import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -24,7 +21,7 @@ import javax.swing.JRootPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.cards.interfaces.ActionCallback; import mage.cards.action.ActionCallback;
import mage.utils.CardUtil; import mage.utils.CardUtil;
import mage.view.PermanentView; import mage.view.PermanentView;
@ -132,10 +129,8 @@ public class CardPanel extends MagePermanent {
tappedAngle = gameCard.isTapped() ? CardPanel.TAPPED_ANGLE : 0; tappedAngle = gameCard.isTapped() ? CardPanel.TAPPED_ANGLE : 0;
try { try {
log.info("loading image..."); log.info(gameCard.getCardNumber() + " " + gameCard.getName() + " " + gameCard.getExpansionSetCode());
BufferedImage srcImage = ImageIO.read(CardPanel.class.getClassLoader().getResourceAsStream("Mountain.40.full.jpg")); BufferedImage srcImage = ImageIO.read(CardPanel.class.getClassLoader().getResourceAsStream("Mountain.40.full.jpg"));
srcImage = null;
log.info("done, image="+srcImage);
if (srcImage != null) { if (srcImage != null) {
//setImage(srcImage, ImageUtil.getBlurredImage(srcImage, 3, 1.0f)); //setImage(srcImage, ImageUtil.getBlurredImage(srcImage, 3, 1.0f));
hasImage = true; hasImage = true;
@ -153,7 +148,7 @@ public class CardPanel extends MagePermanent {
if (hasImage) { if (hasImage) {
titleText.setText(""); titleText.setText("");
} else { } else {
titleText.setText(card.getName() + card.getId()); titleText.setText(card.getName());
} }
} }
@ -268,6 +263,9 @@ public class CardPanel extends MagePermanent {
}*/ }*/
//for debugging
// REMOVEME
/*
Point component = getLocation(); Point component = getLocation();
int cx = getCardX() + component.x; int cx = getCardX() + component.x;
@ -275,10 +273,9 @@ public class CardPanel extends MagePermanent {
int cw = getCardWidth(); int cw = getCardWidth();
int ch = getCardHeight(); int ch = getCardHeight();
System.out.println("x="+component.x);
g2d.setColor(Color.white); g2d.setColor(Color.white);
g2d.drawRect(getCardX() - component.x, getCardY() - component.y, cw, ch); g2d.drawRect(getCardX() - component.x, getCardY() - component.y, cw, ch);
*/
} }
protected void paintChildren (Graphics g) { protected void paintChildren (Graphics g) {
@ -488,7 +485,6 @@ public class CardPanel extends MagePermanent {
int cw = getCardWidth(); int cw = getCardWidth();
int ch = getCardHeight(); int ch = getCardHeight();
if (isTapped()) { if (isTapped()) {
//log.info("tapped");
cy = ch - cw + cx /*+ attachedDy*attachedCount*/; cy = ch - cw + cx /*+ attachedDy*attachedCount*/;
ch = cw; ch = cw;
cw = getCardHeight(); cw = getCardHeight();
@ -511,4 +507,9 @@ public class CardPanel extends MagePermanent {
return this.gameCard; return this.gameCard;
} }
@Override
public Image getImage() {
return this.imagePanel.getSrcImage();
}
} }

View file

@ -172,6 +172,10 @@ public class ScaledImagePanel extends JPanel {
if (info.srcWidth / 2 < info.targetWidth || info.srcHeight / 2 < info.targetHeight) return srcImage; if (info.srcWidth / 2 < info.targetWidth || info.srcHeight / 2 < info.targetHeight) return srcImage;
return srcImageBlurred; return srcImageBlurred;
} }
public Image getSrcImage() {
return srcImage;
}
static private class ScalingInfo { static private class ScalingInfo {
public int targetWidth; public int targetWidth;

View file

@ -1,19 +1,21 @@
package org.mage.plugins.card; package org.mage.plugins.card;
import java.awt.Color;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import mage.cards.CardDimensions; import mage.cards.CardDimensions;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.cards.interfaces.ActionCallback; import mage.cards.action.ActionCallback;
import mage.interfaces.plugin.CardPlugin; import mage.interfaces.plugin.CardPlugin;
import mage.utils.CardUtil; import mage.utils.CardUtil;
import mage.view.PermanentView; import mage.view.PermanentView;
@ -66,7 +68,7 @@ public class CardPluginImpl implements CardPlugin {
@Override @Override
public MagePermanent getMagePermanent(PermanentView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback) { public MagePermanent getMagePermanent(PermanentView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback) {
//log.debug("Card plugin: building mage permanent [w="+dimension.frameWidth+",h="+dimension.frameHeight+"]"); //log.debug("Card plugin: building mage permanent [w="+dimension.frameWidth+",h="+dimension.frameHeight+"]");
CardPanel cardPanel = new CardPanel(permanent, false, callback); CardPanel cardPanel = new CardPanel(permanent, true, callback);
cardPanel.setShowCastingCost(true); cardPanel.setShowCastingCost(true);
cardPanel.setCardBounds(0, 0, dimension.frameWidth, dimension.frameHeight); cardPanel.setCardBounds(0, 0, dimension.frameWidth, dimension.frameHeight);
//cardPanel.setBorder(BorderFactory.createLineBorder(Color.red)); //cardPanel.setBorder(BorderFactory.createLineBorder(Color.red));
@ -78,12 +80,18 @@ public class CardPluginImpl implements CardPlugin {
if (ui == null) if (ui == null)
throw new RuntimeException("Error: no components"); throw new RuntimeException("Error: no components");
JComponent component = ui.get("jScrollPane"); JComponent component = ui.get("jScrollPane");
JComponent component2 = ui.get("battlefieldPanel");
if (component == null) if (component == null)
throw new RuntimeException("Error: jScrollPane is missing"); throw new RuntimeException("Error: jScrollPane is missing");
if (component2 == null)
throw new RuntimeException("Error: battlefieldPanel is missing");
if (!(component instanceof JScrollPane)) if (!(component instanceof JScrollPane))
throw new RuntimeException("Error: jScrollPane has wrong type."); throw new RuntimeException("Error: jScrollPane has wrong type.");
if (!(component instanceof JScrollPane))
throw new RuntimeException("Error: battlefieldPanel is missing");
JScrollPane jScrollPane = (JScrollPane)component; JScrollPane jScrollPane = (JScrollPane)component;
JLayeredPane battlefieldPanel = (JLayeredPane)component2;
Row allLands = new Row(); Row allLands = new Row();
@ -203,11 +211,12 @@ public class CardPluginImpl implements CardPlugin {
for (int panelIndex = 0, panelCount = stack.size(); panelIndex < panelCount; panelIndex++) { for (int panelIndex = 0, panelCount = stack.size(); panelIndex < panelCount; panelIndex++) {
MagePermanent panel = stack.get(panelIndex); MagePermanent panel = stack.get(panelIndex);
int stackPosition = panelCount - panelIndex - 1; int stackPosition = panelCount - panelIndex - 1;
//setComponentZOrder((Component)panel, panelIndex); ///setComponentZOrder((Component)panel, panelIndex);
int panelX = x + (stackPosition * stackSpacingX); int panelX = x + (stackPosition * stackSpacingX);
int panelY = y + (stackPosition * stackSpacingY); int panelY = y + (stackPosition * stackSpacingY);
///panel.setLocation(panelX, panelY); //panel.setLocation(panelX, panelY);
panel.setCardBounds(panelX, panelY, cardWidth, cardHeight); battlefieldPanel.moveToBack(panel);
panel.setCardBounds(panelX + 100, panelY+70, cardWidth, cardHeight);
} }
rowBottom = Math.max(rowBottom, y + stack.getHeight()); rowBottom = Math.max(rowBottom, y + stack.getHeight());
x += stack.getWidth(); x += stack.getWidth();

View file

@ -7,5 +7,5 @@
# #
# #
hand:player:Fireball:2 hand:player:Fireball:2
battlefield:player:Mountain:6 battlefield:player:Mountain:5
battlefield:computer:Brindle Boar:2 battlefield:computer:Brindle Boar:2

View file

@ -31,6 +31,11 @@
<id>mage.googlecode.com</id> <id>mage.googlecode.com</id>
<url>http://magic--another-game-engine.googlecode.com/svn/trunk/repository</url> <url>http://magic--another-game-engine.googlecode.com/svn/trunk/repository</url>
</repository> </repository>
<repository>
<id>java-image-scaling</id>
<name>Java Image Scaling Repository Released</name>
<url>svn:https://java-image-scaling.googlecode.com/svn/repo/released</url>
</repository>
</repositories> </repositories>
<properties> <properties>