mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
crop title bg in portrait mode
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
@@ -19,6 +21,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.UIData;
|
||||
|
||||
/**
|
||||
@@ -196,7 +199,12 @@ public class UIActor extends Group {
|
||||
for (ObjectMap.Entry property : entries) {
|
||||
switch (property.key.toString()) {
|
||||
case "image":
|
||||
newActor.setDrawable(new TextureRegionDrawable(new Texture(Config.instance().getFile(property.value.toString()))));
|
||||
Texture t = new Texture(Config.instance().getFile(property.value.toString()));
|
||||
TextureRegion tr = new TextureRegion(t);
|
||||
if (!Forge.isLandscapeMode() && t.toString().contains("title_bg.png")) {
|
||||
tr.setRegion(t.getWidth()/2 - Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight(), Gdx.graphics.getWidth(), -Gdx.graphics.getHeight());
|
||||
}
|
||||
newActor.setDrawable(new TextureRegionDrawable(tr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,9 @@ public class SplashScreen extends FContainer {
|
||||
private float progress = 0;
|
||||
private boolean finished, openAdventure;
|
||||
//for transition image only...
|
||||
Texture transition_bg = new Texture(GuiBase.isAndroid() ? Gdx.files.internal("fallback_skin").child("title_bg_lq.png") : Gdx.files.classpath("fallback_skin").child("title_bg_lq.png"));
|
||||
TextureRegion transition_bg = new TextureRegion(new Texture(GuiBase.isAndroid()
|
||||
? Gdx.files.internal("fallback_skin").child("title_bg_lq.png")
|
||||
: Gdx.files.classpath("fallback_skin").child("title_bg_lq.png")));
|
||||
|
||||
public void drawBackground(Graphics g) {
|
||||
float percentage = progress / DURATION;
|
||||
@@ -169,7 +171,10 @@ public class SplashScreen extends FContainer {
|
||||
bgAnimation.start();
|
||||
bgAnimation.drawBackground(g);
|
||||
}
|
||||
void drawTransition(Graphics g, Texture bg, boolean openAdventure, float percentage) {
|
||||
void drawTransition(Graphics g, TextureRegion bg, boolean openAdventure, float percentage) {
|
||||
if (!Forge.isLandscapeMode()) {
|
||||
bg.setRegion(bg.getTexture().getWidth()/2 - Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight(), Gdx.graphics.getWidth(), -Gdx.graphics.getHeight());
|
||||
}
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
g.setAlphaComposite(percentage);
|
||||
if (openAdventure) {
|
||||
|
||||
Reference in New Issue
Block a user