mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
update CardImageRenderer, VAvatar
This commit is contained in:
@@ -753,10 +753,24 @@ public class Graphics {
|
|||||||
fillRoundRect(borderColor, x + 1, y + 1, w - 1.5f, h - 1.5f, (h - w) / 10);//used by zoom let some edges show...
|
fillRoundRect(borderColor, x + 1, y + 1, w - 1.5f, h - 1.5f, (h - w) / 10);//used by zoom let some edges show...
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawAvatarImage(FImage image, float x, float y, float w, float h, boolean drawGrayscale) {
|
public void drawAvatarImage(FImage image, float x, float y, float w, float h, boolean drawGrayscale, float amount) {
|
||||||
if (image == null)
|
if (image == null)
|
||||||
return;
|
return;
|
||||||
if (!drawGrayscale) {
|
if (amount > 0) {
|
||||||
|
batch.end();
|
||||||
|
shaderWarp.bind();
|
||||||
|
shaderWarp.setUniformf("u_amount", 0.2f);
|
||||||
|
shaderWarp.setUniformf("u_speed", 0.2f);
|
||||||
|
shaderWarp.setUniformf("u_time", amount);
|
||||||
|
batch.setShader(shaderWarp);
|
||||||
|
batch.begin();
|
||||||
|
//draw
|
||||||
|
image.draw(this, x, y, w, h);
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
} else if (!drawGrayscale) {
|
||||||
image.draw(this, x, y, w, h);
|
image.draw(this, x, y, w, h);
|
||||||
} else {
|
} else {
|
||||||
batch.end();
|
batch.end();
|
||||||
|
|||||||
@@ -915,49 +915,64 @@ public class CardImageRenderer {
|
|||||||
} else if (backColors.get(0) == DetailColors.LAND) {
|
} else if (backColors.get(0) == DetailColors.LAND) {
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_L, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_L, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.MULTICOLOR) {
|
} else if (backColors.get(0) == DetailColors.MULTICOLOR) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.COLORLESS) {
|
} else if (backColors.get(0) == DetailColors.COLORLESS) {
|
||||||
if (isPW)
|
if (state.isVehicle())
|
||||||
g.drawImage(FSkinTexture.PWBG_C, x, y, w, h);
|
|
||||||
else if (state.isVehicle())
|
|
||||||
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isPW)
|
||||||
|
g.drawImage(FSkinTexture.PWBG_C, x, y, w, h);
|
||||||
else if (state.isArtifact())
|
else if (state.isArtifact())
|
||||||
g.drawImage(FSkinTexture.CARDBG_A, x, y, w, h);
|
g.drawImage(FSkinTexture.CARDBG_A, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
|
g.drawImage(FSkinTexture.NYX_C, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(FSkinTexture.CARDBG_C, x, y, w, h);
|
g.drawImage(FSkinTexture.CARDBG_C, x, y, w, h);
|
||||||
//todo add NYX for colorless?
|
|
||||||
} else if (backColors.get(0) == DetailColors.GREEN) {
|
} else if (backColors.get(0) == DetailColors.GREEN) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_G, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_G, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_G : FSkinTexture.CARDBG_G, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_G : FSkinTexture.CARDBG_G, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.RED) {
|
} else if (backColors.get(0) == DetailColors.RED) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_R, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_R, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_R : FSkinTexture.CARDBG_R, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_R : FSkinTexture.CARDBG_R, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.BLACK) {
|
} else if (backColors.get(0) == DetailColors.BLACK) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_B, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_B, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_B : FSkinTexture.CARDBG_B, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_B : FSkinTexture.CARDBG_B, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.BLUE) {
|
} else if (backColors.get(0) == DetailColors.BLUE) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_U, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_U, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_U : FSkinTexture.CARDBG_U, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_U : FSkinTexture.CARDBG_U, x, y, w, h);
|
||||||
} else if (backColors.get(0) == DetailColors.WHITE) {
|
} else if (backColors.get(0) == DetailColors.WHITE) {
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_W, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_W, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_W : FSkinTexture.CARDBG_W, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_W : FSkinTexture.CARDBG_W, x, y, w, h);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
||||||
else {
|
else {
|
||||||
if (!isHybrid) {
|
if (!isHybrid) {
|
||||||
@@ -986,13 +1001,17 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isNyx)
|
if (state.isVehicle())
|
||||||
|
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
|
||||||
|
else if (isNyx)
|
||||||
g.drawImage(FSkinTexture.NYX_C, x, y, w, h);
|
g.drawImage(FSkinTexture.NYX_C, x, y, w, h);
|
||||||
else
|
else
|
||||||
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_C, x, y, w, h);
|
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_C, x, y, w, h);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class VAvatar extends FDisplayObject {
|
|||||||
avatarAnimation = new AvatarAnimation();
|
avatarAnimation = new AvatarAnimation();
|
||||||
}
|
}
|
||||||
private class AvatarAnimation extends ForgeAnimation {
|
private class AvatarAnimation extends ForgeAnimation {
|
||||||
private static final float DURATION = 1.2f;
|
private static final float DURATION = 0.8f;
|
||||||
private float progress = 0;
|
private float progress = 0;
|
||||||
Texture splatter = FSkin.splatter;
|
Texture splatter = FSkin.splatter;
|
||||||
|
|
||||||
@@ -60,23 +60,14 @@ public class VAvatar extends FDisplayObject {
|
|||||||
float oldAlpha = g.getfloatAlphaComposite();
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
float fade = 1-(percentage*1);
|
float fade = 1-(percentage*1);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
|
g.drawAvatarImage(image, x, y, w, h, player.getHasLost(), 0);
|
||||||
drawPlayerIndicator(g, w, h, percentage);
|
drawPlayerIndicator(g, w, h, percentage);
|
||||||
g.setAlphaComposite(fade);
|
g.setAlphaComposite(fade);
|
||||||
g.drawRect(w / 12f, Color.WHITE, 0, 0, w, h);
|
g.drawRect(w / 12f, Color.WHITE, 0, 0, w, h);
|
||||||
g.drawOutlinedText("+"+amount, Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.WHITE, Color.SKY, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
|
g.drawOutlinedText("+"+amount, Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.WHITE, Color.SKY, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
|
||||||
g.setAlphaComposite(oldAlpha);
|
g.setAlphaComposite(oldAlpha);
|
||||||
} else if (amount < 0) {
|
} else if (amount < 0) {
|
||||||
if (splatter == null) {
|
g.drawAvatarImage(image, x, y, w, h, player.getHasLost(), 1-percentage);
|
||||||
g.setColorRGBA(1, percentage, percentage, oldAlpha);
|
|
||||||
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
|
|
||||||
g.resetColorRGBA(oldAlpha);
|
|
||||||
} else {
|
|
||||||
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
|
|
||||||
g.setAlphaComposite(fade);
|
|
||||||
g.drawImage(splatter, x-mod/2, y-mod/2, w+mod, h+mod);
|
|
||||||
g.setAlphaComposite(oldAlpha);
|
|
||||||
}
|
|
||||||
drawPlayerIndicator(g, w, h, percentage);
|
drawPlayerIndicator(g, w, h, percentage);
|
||||||
g.setAlphaComposite(fade);
|
g.setAlphaComposite(fade);
|
||||||
g.drawOutlinedText(String.valueOf(amount), Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.RED, Color.ORANGE, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
|
g.drawOutlinedText(String.valueOf(amount), Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.RED, Color.ORANGE, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
|
||||||
@@ -120,11 +111,11 @@ public class VAvatar extends FDisplayObject {
|
|||||||
avatarAnimation.start();
|
avatarAnimation.start();
|
||||||
avatarAnimation.drawAvatar(g, image, 0, 0, w, h);
|
avatarAnimation.drawAvatar(g, image, 0, 0, w, h);
|
||||||
} else {
|
} else {
|
||||||
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost());
|
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost(), 0);
|
||||||
drawPlayerIndicator(g, w, h, 1);
|
drawPlayerIndicator(g, w, h, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost());
|
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Forge.altPlayerLayout && !Forge.altZoneTabs && Forge.isLandscapeMode())
|
if (Forge.altPlayerLayout && !Forge.altZoneTabs && Forge.isLandscapeMode())
|
||||||
|
|||||||
Reference in New Issue
Block a user