use of com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration in project bdx by GoranM.
the class DesktopLauncher method main.
public static void main(String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "FontWriter";
config.width = 666;
config.height = 444;
final ArrayList<String[]> files = new ArrayList<>();
for (String a : arg) files.add(a.split("---"));
new LwjglApplication(new ApplicationAdapter() {
public void create() {
for (String[] commands : files) {
boolean properlyCreated = false;
int resX = 256;
int resY = 256;
while (!properlyCreated) {
// Supply the full path
String inputFontPath = commands[0];
FileHandle outputFolder = Gdx.files.absolute(commands[1]);
String fileName = outputFolder.nameWithoutExtension();
outputFolder = outputFolder.parent();
int fontSize = Integer.valueOf(commands[2]);
int shadowOffsetX = Integer.valueOf(commands[3]);
int shadowOffsetY = Integer.valueOf(commands[4]);
Color shadowColor = new Color(Float.valueOf(commands[5]), Float.valueOf(commands[6]), Float.valueOf(commands[7]), Float.valueOf(commands[8]));
int outlineThickness = Integer.valueOf(commands[9]);
Color outlineColor = new Color(Float.valueOf(commands[10]), Float.valueOf(commands[11]), Float.valueOf(commands[12]), Float.valueOf(commands[13]));
boolean outlineRounded = Boolean.valueOf(commands[14]);
BitmapFontWriter.FontInfo fontInfo = new BitmapFontWriter.FontInfo();
fontInfo.padding = new BitmapFontWriter.Padding(1, 1, 1, 1);
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.absolute(inputFontPath));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.color = new Color(Float.valueOf(commands[15]), Float.valueOf(commands[16]), Float.valueOf(commands[17]), Float.valueOf(commands[18]));
parameter.borderColor = outlineColor;
parameter.borderWidth = outlineThickness;
parameter.borderStraight = !outlineRounded;
parameter.shadowOffsetX = shadowOffsetX;
parameter.shadowOffsetY = shadowOffsetY;
parameter.shadowColor = shadowColor;
parameter.size = fontSize;
parameter.packer = new PixmapPacker(resX, resY, Pixmap.Format.RGBA8888, 2, false, new PixmapPacker.SkylineStrategy());
FreeTypeFontGenerator.FreeTypeBitmapFontData data = generator.generateData(parameter);
// Writes the .fnt file, I guess
BitmapFontWriter.writeFont(data, new String[] { fileName + ".png" }, outputFolder.child(fileName + ".fnt"), fontInfo, resX, resY);
BitmapFontWriter.writePixmaps(parameter.packer.getPages(), outputFolder, fileName);
generator.dispose();
FileHandle path = outputFolder.child(fileName + ".png");
if (path.exists())
properlyCreated = true;
else {
// BitmapFontWriter generated multiple bitmaps; can't use them.
// We re-run with higher source texture res so they should fit
resX *= 2;
// on a single texture, continuously as necessary.
resY *= 2;
for (FileHandle f : outputFolder.list()) {
if (f.nameWithoutExtension().contains(fileName + "_") && f.extension().equals("png"))
f.delete();
}
}
}
}
Gdx.app.exit();
}
}, config);
}
use of com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration in project shattered-pixel-dungeon-gdx by 00-Evan.
the class DesktopLauncher method main.
public static void main(String[] arg) {
String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
if (version == null) {
version = "0.6.4";
}
int versionCode;
try {
versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
} catch (NumberFormatException e) {
versionCode = 251;
}
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
if (SharedLibraryLoader.isMac) {
config.preferencesDirectory = "Library/Application Support/Shattered Pixel Dungeon/";
} else if (SharedLibraryLoader.isLinux) {
config.preferencesDirectory = ".shatteredpixel/shattered-pixel-dungeon/";
} else if (SharedLibraryLoader.isWindows) {
String winVer = System.getProperties().getProperty("os.name");
if (winVer.contains("XP")) {
config.preferencesDirectory = "Application Data/.shatteredpixel/Shattered Pixel Dungeon/";
} else {
config.preferencesDirectory = "AppData/Roaming/.shatteredpixel/Shattered Pixel Dungeon/";
}
}
// FIXME: This is a hack to get access to the preferences before we have an application setup
com.badlogic.gdx.Preferences prefs = new LwjglPreferences(SPDSettings.FILE_NAME, config.preferencesDirectory);
boolean isFullscreen = prefs.getBoolean(SPDSettings.KEY_WINDOW_FULLSCREEN, false);
// config.fullscreen = isFullscreen;
if (!isFullscreen) {
config.width = prefs.getInteger(SPDSettings.KEY_WINDOW_WIDTH, SPDSettings.DEFAULT_WINDOW_WIDTH);
config.height = prefs.getInteger(SPDSettings.KEY_WINDOW_HEIGHT, SPDSettings.DEFAULT_WINDOW_HEIGHT);
}
config.addIcon("ic_launcher_128.png", Files.FileType.Internal);
config.addIcon("ic_launcher_32.png", Files.FileType.Internal);
config.addIcon("ic_launcher_16.png", Files.FileType.Internal);
// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
config.title = "Shattered Pixel Dungeon";
new LwjglApplication(new ShatteredPixelDungeon(new DesktopSupport(version, versionCode, config.preferencesDirectory, new DesktopInputProcessor())), config);
}
use of com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration in project ultimate-java by pantinor.
the class SpriteAtlasTool method main.
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "Sprite Atlas Tool";
cfg.width = screenWidth;
cfg.height = screenHeight;
new LwjglApplication(new SpriteAtlasTool(), cfg);
}
use of com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration in project ultimate-java by pantinor.
the class WaterTest method main.
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "test";
cfg.width = 800;
cfg.height = 600;
new LwjglApplication(new WaterTest(), cfg);
}
use of com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration in project AnotherMonekyParadox by SantiagoMille.
the class DesktopLauncher method main.
public static void main(String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 1280;
config.height = 720;
new LwjglApplication(new Main(), config);
}
Aggregations