Epiko blue marble, green forest and white angel themes.
Support for stretching for background texture in theme. Updated runtime.master
parent
8ac3a79fdf
commit
851486c87d
Binary file not shown.
Binary file not shown.
|
@ -31,7 +31,7 @@ Release 1.7 (January 14, 2011)
|
|||
- new splash screen
|
||||
- added mana info for lands in hand and on battlefield
|
||||
- added Enter as hotkey to switch between image and text mode
|
||||
- added support for user made UI themes that must be downloaded separately
|
||||
- added support for user made UI themes that can be downloaded separately
|
||||
- added support for user defined card cubes next to the default cube
|
||||
|
||||
- fixed Pongify, it can now target your own permanents with filter legal targets enabled
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -26,9 +26,8 @@ import magic.model.MagicCubeDefinition;
|
|||
import magic.model.MagicDeckCard;
|
||||
import magic.model.MagicPlayerProfile;
|
||||
import magic.ui.resolution.DefaultResolutionProfile;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.viewer.CardViewer;
|
||||
import magic.ui.widget.BackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
import magic.ui.widget.FontsAndBorders;
|
||||
|
||||
public class ExplorerPanel extends JPanel implements ActionListener {
|
||||
|
@ -53,7 +52,7 @@ public class ExplorerPanel extends JPanel implements ActionListener {
|
|||
|
||||
private final MagicFrame frame;
|
||||
private final EditDeckCard editDeckCard;
|
||||
private final BackgroundLabel backgroundLabel;
|
||||
private final ZoneBackgroundLabel backgroundLabel;
|
||||
private final CardViewer cardViewer;
|
||||
private final ExplorerFilterPanel filterPanel;
|
||||
private final JScrollPane cardsScrollPane;
|
||||
|
@ -112,7 +111,7 @@ public class ExplorerPanel extends JPanel implements ActionListener {
|
|||
closeButton.addActionListener(this);
|
||||
add(closeButton);
|
||||
|
||||
backgroundLabel=new BackgroundLabel(Theme.TEXTURE_BACKGROUND);
|
||||
backgroundLabel=new ZoneBackgroundLabel();
|
||||
backgroundLabel.setBounds(0,0,0,0);
|
||||
add(backgroundLabel);
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ import javax.swing.JLayeredPane;
|
|||
|
||||
import magic.ui.viewer.CardViewer;
|
||||
import magic.ui.viewer.LogBookViewer;
|
||||
import magic.ui.widget.BattlefieldBackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
|
||||
public class GameLayeredPane extends JLayeredPane {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public GameLayeredPane(final GamePanel gamePanel,final BattlefieldBackgroundLabel backgroundLabel) {
|
||||
public GameLayeredPane(final GamePanel gamePanel,final ZoneBackgroundLabel backgroundLabel) {
|
||||
|
||||
setLayout(null);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import magic.ui.viewer.PlayerViewer;
|
|||
import magic.ui.viewer.StackCombatViewer;
|
||||
import magic.ui.viewer.StackViewer;
|
||||
import magic.ui.viewer.ViewerInfo;
|
||||
import magic.ui.widget.BattlefieldBackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
import magic.ui.widget.TitleBar;
|
||||
|
||||
public class GamePanel extends JPanel {
|
||||
|
@ -50,7 +50,7 @@ public class GamePanel extends JPanel {
|
|||
|
||||
private final MagicFrame frame;
|
||||
private final MagicGame game;
|
||||
private final BattlefieldBackgroundLabel backgroundLabel;
|
||||
private final ZoneBackgroundLabel backgroundLabel;
|
||||
private final GameController controller;
|
||||
private final ViewerInfo viewerInfo;
|
||||
private final PlayerViewer playerViewer;
|
||||
|
@ -73,7 +73,7 @@ public class GamePanel extends JPanel {
|
|||
private final ImageCombatViewer imageCombatViewer;
|
||||
private final ImageViewer imageViewer;
|
||||
|
||||
public GamePanel(final MagicFrame frame,final MagicGame game,final BattlefieldBackgroundLabel backgroundLabel) {
|
||||
public GamePanel(final MagicFrame frame,final MagicGame game,final ZoneBackgroundLabel backgroundLabel) {
|
||||
|
||||
this.frame=frame;
|
||||
this.game=game;
|
||||
|
|
|
@ -21,7 +21,7 @@ import magic.data.KeywordDefinitions;
|
|||
import magic.data.KeywordDefinitions.KeywordDefinition;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.theme.ThemeFactory;
|
||||
import magic.ui.widget.BackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
import magic.ui.widget.FontsAndBorders;
|
||||
import magic.ui.widget.TexturedPanel;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class KeywordsPanel extends JPanel implements ActionListener {
|
|||
);
|
||||
|
||||
private final MagicFrame frame;
|
||||
private final BackgroundLabel backgroundLabel;
|
||||
private final ZoneBackgroundLabel backgroundLabel;
|
||||
private final JScrollPane keywordsPane;
|
||||
private final JButton closeButton;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class KeywordsPanel extends JPanel implements ActionListener {
|
|||
final JPanel keywordsPanel=createKeywordsPanel();
|
||||
keywordsPane.getViewport().add(keywordsPanel);
|
||||
|
||||
backgroundLabel=new BackgroundLabel(Theme.TEXTURE_BACKGROUND);
|
||||
backgroundLabel=new ZoneBackgroundLabel();
|
||||
backgroundLabel.setBounds(0,0,0,0);
|
||||
add(backgroundLabel);
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@ import magic.model.MagicPlayerDefinition;
|
|||
import magic.model.MagicPlayerProfile;
|
||||
import magic.model.MagicTournament;
|
||||
import magic.test.TestGameBuilder;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.widget.BackgroundLabel;
|
||||
import magic.ui.widget.BattlefieldBackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
|
||||
public class MagicFrame extends JFrame implements ActionListener {
|
||||
|
||||
|
@ -276,7 +274,7 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
enableMenuItem(SWAP_DECKS_ITEM,tournament.isEditable());
|
||||
enableMenuItem(PLAY_GAME_ITEM,!tournament.isFinished());
|
||||
} else {
|
||||
setContent(new BackgroundLabel(Theme.TEXTURE_BACKGROUND));
|
||||
setContent(new ZoneBackgroundLabel());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +378,8 @@ public class MagicFrame extends JFrame implements ActionListener {
|
|||
|
||||
private void openGame(final MagicGame game) {
|
||||
|
||||
final BattlefieldBackgroundLabel backgroundLabel=new BattlefieldBackgroundLabel();
|
||||
final ZoneBackgroundLabel backgroundLabel=new ZoneBackgroundLabel();
|
||||
backgroundLabel.setGame(true);
|
||||
gamePanel=new GamePanel(this,game,backgroundLabel);
|
||||
final GameLayeredPane gamePane=new GameLayeredPane(gamePanel,backgroundLabel);
|
||||
setContent(gamePane);
|
||||
|
|
|
@ -17,14 +17,13 @@ import magic.model.MagicTournament;
|
|||
import magic.ui.resolution.ResolutionProfileResult;
|
||||
import magic.ui.resolution.ResolutionProfileType;
|
||||
import magic.ui.resolution.ResolutionProfiles;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.viewer.CardViewer;
|
||||
import magic.ui.viewer.DeckStatisticsViewer;
|
||||
import magic.ui.viewer.DeckStrengthViewer;
|
||||
import magic.ui.viewer.DeckViewers;
|
||||
import magic.ui.viewer.PlayersViewer;
|
||||
import magic.ui.viewer.TournamentDifficultyViewer;
|
||||
import magic.ui.widget.BackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
import magic.ui.widget.FontsAndBorders;
|
||||
|
||||
public class TournamentPanel extends JPanel implements ActionListener {
|
||||
|
@ -33,7 +32,7 @@ public class TournamentPanel extends JPanel implements ActionListener {
|
|||
|
||||
private final MagicFrame frame;
|
||||
private final MagicTournament tournament;
|
||||
private final BackgroundLabel backgroundLabel;
|
||||
private final ZoneBackgroundLabel backgroundLabel;
|
||||
private final PlayersViewer playersViewer;
|
||||
private final CardViewer cardViewer;
|
||||
private final DeckViewers deckViewers;
|
||||
|
@ -86,7 +85,7 @@ public class TournamentPanel extends JPanel implements ActionListener {
|
|||
newButton.setFocusable(false);
|
||||
add(newButton);
|
||||
|
||||
backgroundLabel=new BackgroundLabel(Theme.TEXTURE_BACKGROUND);
|
||||
backgroundLabel=new ZoneBackgroundLabel();
|
||||
backgroundLabel.setBounds(0,0,0,0);
|
||||
add(backgroundLabel);
|
||||
|
||||
|
|
|
@ -18,9 +18,8 @@ import magic.data.IconImages;
|
|||
import magic.model.MagicCardDefinition;
|
||||
import magic.model.MagicRandom;
|
||||
import magic.ui.resolution.DefaultResolutionProfile;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.viewer.CardViewer;
|
||||
import magic.ui.widget.BackgroundLabel;
|
||||
import magic.ui.widget.ZoneBackgroundLabel;
|
||||
import magic.ui.widget.FontsAndBorders;
|
||||
|
||||
public class VersionPanel extends JPanel {
|
||||
|
@ -35,7 +34,7 @@ public class VersionPanel extends JPanel {
|
|||
|
||||
private static final Border LOGO_BORDER=BorderFactory.createMatteBorder(2,2,2,2,new Color(0x8C,0x78,0x53));
|
||||
|
||||
private final BackgroundLabel backgroundLabel;
|
||||
private final ZoneBackgroundLabel backgroundLabel;
|
||||
private final JLabel versionLabel;
|
||||
private final JLabel logoLabel;
|
||||
private final CardViewer cardViewer;
|
||||
|
@ -51,7 +50,7 @@ public class VersionPanel extends JPanel {
|
|||
versionLabel.setBorder(FontsAndBorders.EMPTY_BORDER);
|
||||
add(versionLabel,BorderLayout.SOUTH);
|
||||
|
||||
backgroundLabel=new BackgroundLabel(Theme.TEXTURE_BACKGROUND);
|
||||
backgroundLabel=new ZoneBackgroundLabel();
|
||||
|
||||
final ImageIcon logoIcon=new ImageIcon(IconImages.LOGO);
|
||||
logoLabel=new JLabel(logoIcon);
|
||||
|
|
|
@ -62,6 +62,7 @@ public abstract class AbstractTheme implements Theme {
|
|||
addToTheme(COLOR_GAME_BORDER,Color.BLACK);
|
||||
|
||||
addToTheme(VALUE_SPACING,0);
|
||||
addToTheme(VALUE_BACKGROUND_STRETCH,0);
|
||||
addToTheme(VALUE_GAME_LAYOUT,1);
|
||||
addToTheme(VALUE_GAME_STRETCH,0);
|
||||
addToTheme(VALUE_GAME_OFFSET,0);
|
||||
|
|
|
@ -43,6 +43,7 @@ public interface Theme {
|
|||
public static final String COLOR_GAME_BORDER="color_game_border";
|
||||
|
||||
public static final String VALUE_SPACING="value_spacing";
|
||||
public static final String VALUE_BACKGROUND_STRETCH="value_background_stretch";
|
||||
public static final String VALUE_GAME_LAYOUT="value_game_layout";
|
||||
public static final String VALUE_GAME_STRETCH="value_game_stretch";
|
||||
public static final String VALUE_GAME_OFFSET="value_game_offset";
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package magic.ui.widget;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import magic.ui.theme.ThemeFactory;
|
||||
|
||||
public class BackgroundLabel extends JLabel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String texture;
|
||||
|
||||
public BackgroundLabel(final String texture) {
|
||||
|
||||
this.texture=texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g) {
|
||||
|
||||
final BufferedImage image=ThemeFactory.getInstance().getCurrentTheme().getTexture(texture);
|
||||
final int imageWidth=image.getWidth();
|
||||
final int imageHeight=image.getHeight();
|
||||
final int width=this.getWidth();
|
||||
final int height=this.getHeight();
|
||||
|
||||
for (int y=0;y<height;y+=imageHeight) {
|
||||
|
||||
for (int x=0;x<width;x+=imageWidth) {
|
||||
|
||||
g.drawImage(image,x,y,this);
|
||||
}
|
||||
}
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
|
@ -13,14 +13,20 @@ import magic.ui.resolution.ResolutionProfileType;
|
|||
import magic.ui.theme.Theme;
|
||||
import magic.ui.theme.ThemeFactory;
|
||||
|
||||
public class BattlefieldBackgroundLabel extends JLabel {
|
||||
public class ZoneBackgroundLabel extends JLabel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean game=false;
|
||||
private boolean image=true;
|
||||
private int playerX=0;
|
||||
private int handY=0;
|
||||
|
||||
public void setGame(final boolean game) {
|
||||
|
||||
this.game=game;
|
||||
}
|
||||
|
||||
public void setImage(final boolean image) {
|
||||
|
||||
this.image=image;
|
||||
|
@ -79,45 +85,52 @@ public class BattlefieldBackgroundLabel extends JLabel {
|
|||
|
||||
final Dimension size=getSize();
|
||||
final Theme theme=ThemeFactory.getInstance().getCurrentTheme();
|
||||
final int stretch=theme.getValue(Theme.VALUE_GAME_STRETCH);
|
||||
final boolean battlefieldStretch=(stretch&1)==1;
|
||||
final boolean playerStretch=(stretch&2)==2;
|
||||
final boolean handStretch=(stretch&4)==4;
|
||||
|
||||
switch (theme.getValue(Theme.VALUE_GAME_LAYOUT)) {
|
||||
case 1:
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(0,0,size.width,size.height),battlefieldStretch);
|
||||
break;
|
||||
case 2:
|
||||
if (image) {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_PLAYER),new Rectangle(0,0,size.width,size.height),playerStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,handY),battlefieldStretch);
|
||||
} else {
|
||||
|
||||
if (game) {
|
||||
final int stretch=theme.getValue(Theme.VALUE_GAME_STRETCH);
|
||||
final boolean battlefieldStretch=(stretch&1)==1;
|
||||
final boolean playerStretch=(stretch&2)==2;
|
||||
final boolean handStretch=(stretch&4)==4;
|
||||
|
||||
switch (theme.getValue(Theme.VALUE_GAME_LAYOUT)) {
|
||||
case 1:
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(0,0,size.width,size.height),battlefieldStretch);
|
||||
break;
|
||||
case 2:
|
||||
if (image) {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_PLAYER),new Rectangle(0,0,size.width,size.height),playerStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,handY),battlefieldStretch);
|
||||
} else {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_PLAYER),new Rectangle(0,0,playerX,size.height),playerStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,size.height),battlefieldStretch);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_PLAYER),new Rectangle(0,0,playerX,size.height),playerStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,size.height),battlefieldStretch);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_PLAYER),new Rectangle(0,0,playerX,size.height),playerStretch);
|
||||
if (image) {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,handY),battlefieldStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_HAND),new Rectangle(playerX,handY,size.width-playerX,handY),handStretch);
|
||||
} else {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,size.height),battlefieldStretch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
final int border=theme.getValue(Theme.VALUE_GAME_BORDER);
|
||||
if (border>0) {
|
||||
final Graphics2D g2d=(Graphics2D)g;
|
||||
g2d.setPaint(theme.getColor(Theme.COLOR_GAME_BORDER));
|
||||
if (image) {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,handY),battlefieldStretch);
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_HAND),new Rectangle(playerX,handY,size.width-playerX,handY),handStretch);
|
||||
g2d.fillRect(playerX,0,border,handY);
|
||||
g2d.fillRect(playerX,handY,size.width-playerX,border);
|
||||
} else {
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BATTLEFIELD),new Rectangle(playerX,0,size.width-playerX,size.height),battlefieldStretch);
|
||||
g2d.fillRect(playerX,0,border,size.height);
|
||||
}
|
||||
break;
|
||||
}
|
||||
final int border=theme.getValue(Theme.VALUE_GAME_BORDER);
|
||||
if (border>0) {
|
||||
final Graphics2D g2d=(Graphics2D)g;
|
||||
g2d.setPaint(theme.getColor(Theme.COLOR_GAME_BORDER));
|
||||
if (image) {
|
||||
g2d.fillRect(playerX,0,border,handY);
|
||||
g2d.fillRect(playerX,handY,size.width-playerX,border);
|
||||
} else {
|
||||
g2d.fillRect(playerX,0,border,size.height);
|
||||
}
|
||||
} else {
|
||||
final boolean stretchTexture=theme.getValue(Theme.VALUE_BACKGROUND_STRETCH)==1;
|
||||
paintZone(g,theme.getTexture(Theme.TEXTURE_BACKGROUND),new Rectangle(0,0,size.width,size.height),stretchTexture);
|
||||
}
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue