-moved ui positions from code to json

-added separate ui for portrait mode
-removed add to deck/sideboad in shop in inventory view
-moved skin to ttf font
This commit is contained in:
Grimm
2022-04-14 21:00:27 +02:00
parent 80c51f4ef5
commit 0a7d5c334a
68 changed files with 1154 additions and 12260 deletions

View File

@@ -1,22 +1,17 @@
package forge.adventure.util;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import java.util.function.Function;
@@ -25,7 +20,7 @@ import java.util.function.Function;
*/
public class Controls {
private static Skin SelectedSkin = null;
private static BitmapFont defaultfont, bigfont, miKrollFantasy;
private static BitmapFont defaultfont, bigfont;
static public TextButton newTextButton(String text) {
@@ -103,8 +98,6 @@ public class Controls {
static public BitmapFont getBitmapFont(String fontName) {
switch (fontName) {
case "MiKrollFantasyBig":
return miKrollFantasy;
case "blackbig":
case "big":
return bigfont;
@@ -122,32 +115,39 @@ public class Controls {
FileHandle skinFile = Config.instance().getFile(Paths.SKIN);
FileHandle atlasFile = skinFile.sibling(skinFile.nameWithoutExtension() + ".atlas");
TextureAtlas atlas = new TextureAtlas(atlasFile);
SelectedSkin.addRegions(atlas);
SelectedSkin.load(skinFile);
//font
defaultfont = new BitmapFont(Config.instance().getFile(Paths.SKIN).sibling("LanaPixelCJK.fnt"));
miKrollFantasy = new BitmapFont(Config.instance().getFile(Paths.SKIN).sibling("MiKrollFantasyBig.fnt"));
bigfont = new BitmapFont(Config.instance().getFile(Paths.SKIN).sibling("LanaPixelCJK.fnt"));
bigfont.getData().setScale(2, 2);
FreeTypeFontGenerator generateFonts=new FreeTypeFontGenerator(Config.instance().getFile(Paths.SKIN_FONT));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.borderWidth=0;
parameter.incremental = true;
parameter.mono=true;
parameter.size=11;
parameter.minFilter = Texture.TextureFilter.Nearest;
parameter.magFilter = Texture.TextureFilter.Nearest;
parameter.color= Color.WHITE;
defaultfont = generateFonts.generateFont(parameter);
parameter.size=22;
parameter.color= Color.WHITE;
bigfont = generateFonts.generateFont(parameter);
SelectedSkin.add("default",defaultfont);
SelectedSkin.add("big",bigfont);
SelectedSkin.addRegions(atlas);
SelectedSkin.load(skinFile);
}
return SelectedSkin;
}
public static Label newLabel(String name) {
Label ret = new Label(name, GetSkin());
if (!Forge.isLandscapeMode()) {
ret.setFontScaleX(2);
}
return ret;
}
public static Dialog newDialog(String title) {
Dialog ret = new Dialog(title, GetSkin());
ret.setMovable(false);
if (!Forge.isLandscapeMode()) {
ret.getTitleLabel().setFontScaleX(2);
}
return ret;
}