mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
stronger highlighting for selectable cards
This commit is contained in:
@@ -253,6 +253,13 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
g2d.rotate(getTappedAngle(), cardXOffset + edgeOffset, (cardYOffset + cardHeight)
|
||||
- edgeOffset);
|
||||
}
|
||||
boolean selectable = matchUI.isSelectable(getCard());
|
||||
if ( titleText!=null ) { // selectable cards have colored names
|
||||
titleText.setForeground(selectable?Color.cyan:Color.white);
|
||||
}
|
||||
// if ( imagePanel != null ) { // if selecting, darken non-selectable cards - needs more refreshing to do right
|
||||
// imagePanel.setBrightness(selectable?1.0f:(matchUI.isSelecting()?0.5f:1.0f));
|
||||
//}
|
||||
super.paint(g2d);
|
||||
}
|
||||
|
||||
@@ -268,25 +275,21 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
final int cornerSize = noBorderPref && !cardImgHasAlpha ? 0 : Math.max(4, Math.round(cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||
final int offset = isTapped() && (!noBorderPref || cardImgHasAlpha) ? 1 : 0;
|
||||
|
||||
// Magenta outline for when card was chosen to pay
|
||||
// Magenta outline for when card is chosen
|
||||
if (matchUI.isUsedToPay(getCard())) {
|
||||
g2d.setColor(Color.magenta);
|
||||
final int n2 = Math.max(4, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
||||
} else if (matchUI.isSelectable(getCard())) { // Cyan outline for selectable cards
|
||||
g2d.setColor(Color.cyan);
|
||||
final int n2 = Math.max(4, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
final int n2 = Math.max(1, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
||||
}
|
||||
|
||||
// Green outline for hover
|
||||
if (isSelected) {
|
||||
g2d.setColor(Color.green);
|
||||
final int n = Math.max(4, Math.round(cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset - n, (cardYOffset - n) + offset, cardWidth + (n * 2), cardHeight + (n * 2), cornerSize + n , cornerSize + n);
|
||||
final int n = Math.max(1, Math.round(cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset - n, (cardYOffset - n) + offset, cardWidth + (n * 2), cardHeight + (n * 2), cornerSize + n , cornerSize + n);
|
||||
}
|
||||
|
||||
// Black fill - (will become outline for white bordered cards)
|
||||
// Black fill - (will become an outline for white bordered cards)
|
||||
g2d.setColor(Color.black);
|
||||
g2d.fillRoundRect(cardXOffset, cardYOffset + offset, cardWidth, cardHeight, cornerSize, cornerSize);
|
||||
|
||||
@@ -309,6 +312,13 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
g2d.fillRoundRect(cardXOffset + ins, cardYOffset + ins, cardWidth - ins*2, cardHeight - ins*2, cornerSize-ins, cornerSize-ins);
|
||||
}
|
||||
}
|
||||
|
||||
if (matchUI.isSelectable(getCard())) { // Replace border for selectable cards
|
||||
g2d.setColor(Color.cyan);
|
||||
// final int n2 = Math.max(2, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset, (cardYOffset) + offset, cardWidth, cardHeight, cornerSize, cornerSize);
|
||||
// g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawManaCost(final Graphics g, final ManaCost cost, final int deltaY) {
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.view.arcane;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RescaleOp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -37,6 +38,10 @@ public class ScaledImagePanel extends JPanel {
|
||||
*
|
||||
*/
|
||||
private volatile BufferedImage srcImage;
|
||||
private float brightness = 1.0f;
|
||||
public void setBrightness(final float bright) {
|
||||
brightness = bright;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -127,7 +132,9 @@ public class ScaledImagePanel extends JPanel {
|
||||
} else {
|
||||
int x = (sz.width / 2) - (img.getWidth() / 2);
|
||||
int y = (sz.height / 2) - (img.getHeight() / 2);
|
||||
g.drawImage(img, x, y, null);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
RescaleOp brighten = new RescaleOp(brightness,0,null);
|
||||
g2d.drawImage(img, brighten, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user