mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Merge pull request #2657 from kevlahnota/newmaster2
update initial skin texture load
This commit is contained in:
@@ -350,12 +350,21 @@ public class Forge implements ApplicationListener {
|
|||||||
FileHandle transitionFile = Config.instance().getFile("ui/transition.png");
|
FileHandle transitionFile = Config.instance().getFile("ui/transition.png");
|
||||||
FileHandle titleBGFile = isLandscapeMode() ? Config.instance().getFile("ui/title_bg.png") : Config.instance().getFile("ui/title_bg_portrait.png");
|
FileHandle titleBGFile = isLandscapeMode() ? Config.instance().getFile("ui/title_bg.png") : Config.instance().getFile("ui/title_bg_portrait.png");
|
||||||
FileHandle vsIcon = Config.instance().getFile("ui/vs.png");
|
FileHandle vsIcon = Config.instance().getFile("ui/vs.png");
|
||||||
if (vsIcon.exists())
|
if (vsIcon.exists()) {
|
||||||
getAssets().fallback_skins().put("vs", new Texture(vsIcon));
|
Texture old = getAssets().fallback_skins().put("vs", new Texture(vsIcon));
|
||||||
if (transitionFile.exists())
|
if (old != null)
|
||||||
getAssets().fallback_skins().put("transition", new Texture(transitionFile));
|
old.dispose();
|
||||||
if (titleBGFile.exists())
|
}
|
||||||
getAssets().fallback_skins().put("title", new Texture(titleBGFile));
|
if (transitionFile.exists()) {
|
||||||
|
Texture old = getAssets().fallback_skins().put("transition", new Texture(transitionFile));
|
||||||
|
if (old != null)
|
||||||
|
old.dispose();
|
||||||
|
}
|
||||||
|
if (titleBGFile.exists()) {
|
||||||
|
Texture old = getAssets().fallback_skins().put("title", new Texture(titleBGFile));
|
||||||
|
if (old != null)
|
||||||
|
old.dispose();
|
||||||
|
}
|
||||||
AdventureScreen.preload();
|
AdventureScreen.preload();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package forge.assets;
|
package forge.assets;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Files.FileType;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.assets.AssetLoaderParameters;
|
import com.badlogic.gdx.assets.AssetLoaderParameters;
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
@@ -235,12 +236,11 @@ public class Assets implements Disposable {
|
|||||||
return getDummy();
|
return getDummy();
|
||||||
}
|
}
|
||||||
//internal path can be inside apk or jar..
|
//internal path can be inside apk or jar..
|
||||||
if (file.path().contains("fallback_skin")) {
|
if (!FileType.Absolute.equals(file.type()) || file.path().contains("fallback_skin")) {
|
||||||
Texture f = fallback_skins().get(file.path());
|
if (!fallback_skins().containsKey(file.path())) {
|
||||||
if (f == null) {
|
|
||||||
fallback_skins().put(file.path(), new Texture(file));
|
fallback_skins().put(file.path(), new Texture(file));
|
||||||
}
|
}
|
||||||
return f;
|
return fallback_skins().get(file.path());
|
||||||
}
|
}
|
||||||
Texture t = manager.get(file.path(), Texture.class, false);
|
Texture t = manager.get(file.path(), Texture.class, false);
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
|
|||||||
@@ -168,39 +168,31 @@ public class FSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int w, h;
|
int w=0, h=0;
|
||||||
if (f.path().contains("fallback_skin")) {
|
Texture texF = Forge.getAssets().getTexture(f);
|
||||||
//the file is not accesible by the assetmanager using absolute fileresolver since it resides on internal path or classpath
|
if (f2.exists()) {
|
||||||
Texture txSplash = new Texture(f);
|
Texture texF2 = Forge.getAssets().getTexture(f2);
|
||||||
w = txSplash.getWidth();
|
w = texF2.getWidth();
|
||||||
h = txSplash.getHeight();
|
h = texF2.getHeight();
|
||||||
splashScreen.setSplashTexture(new TextureRegion(txSplash, 0, 0, w, h - 100));
|
splashScreen.setSplashTexture(new TextureRegion(texF2));
|
||||||
} else {
|
} else if (texF != null) {
|
||||||
manager.load(f.path(), Texture.class);
|
w = texF.getWidth();
|
||||||
manager.finishLoadingAsset(f.path());
|
h = texF.getHeight();
|
||||||
w = manager.get(f.path(), Texture.class).getWidth();
|
splashScreen.setSplashTexture(new TextureRegion(texF, 0, 0, w, h - 100));
|
||||||
h = manager.get(f.path(), Texture.class).getHeight();
|
|
||||||
|
|
||||||
if (f2.exists()) {
|
|
||||||
manager.load(f2.path(), Texture.class, Forge.getAssets().getTextureFilter());
|
|
||||||
manager.finishLoadingAsset(f2.path());
|
|
||||||
splashScreen.setSplashTexture(new TextureRegion(manager.get(f2.path(), Texture.class)));
|
|
||||||
} else {
|
|
||||||
splashScreen.setSplashTexture(new TextureRegion(manager.get(f.path(), Texture.class), 0, 0, w, h - 100));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Pixmap pxSplash = new Pixmap(f);
|
Pixmap pxSplash = new Pixmap(f);
|
||||||
//override splashscreen startup
|
//override splashscreen startup
|
||||||
if (Forge.selector.equals("Adventure")) {
|
if (Forge.selector.equals("Adventure")) {
|
||||||
if (f3.exists()) {
|
if (f3.exists()) {
|
||||||
Texture advSplash = new Texture(f3);
|
Texture advSplash = Forge.getAssets().getTexture(f3);
|
||||||
w = advSplash.getWidth();
|
w = advSplash.getWidth();
|
||||||
h = advSplash.getHeight();
|
h = advSplash.getHeight();
|
||||||
splashScreen.setSplashTexture(new TextureRegion(advSplash, 0, 0, w, h - 100));
|
splashScreen.setSplashTexture(new TextureRegion(advSplash, 0, 0, w, h - 100));
|
||||||
pxSplash = new Pixmap(f3);
|
pxSplash = new Pixmap(f3);
|
||||||
}
|
}
|
||||||
if (f4.exists()) {
|
if (f4.exists()) {
|
||||||
Texture advBG = new Texture(f4);
|
Texture advBG = Forge.getAssets().getTexture(f4);
|
||||||
advBG.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
advBG.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
||||||
splashScreen.setSplashBGTexture(advBG);
|
splashScreen.setSplashBGTexture(advBG);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user