Search in sources :

Example 26 with LwjglApplication

use of com.badlogic.gdx.backends.lwjgl.LwjglApplication in project Alkahest-Coffee by AlkahestDev.

the class DesktopLauncher method main.

public static void main(String[] arg) {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.title = "Alkahest Coffee Corporation";
    /*config.fullscreen = true;
        config.width=999999; //TODO: make a better way of fullscreening : i made one in fakeMainGame, but the hitboxes dont work :/
        config.height=999999;*/
    config.width = 1280;
    config.height = 720;
    config.resizable = false;
    config.addIcon("badAlkahest.png", Files.FileType.Internal);
    new LwjglApplication(new MainGame(), config);
}
Also used : LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) MainGame(me.dumfing.client.maingame.MainGame) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)

Example 27 with LwjglApplication

use of com.badlogic.gdx.backends.lwjgl.LwjglApplication in project Alkahest-Coffee by AlkahestDev.

the class tester method main.

public static void main(String[] arg) {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    new LwjglApplication(new fakeMainGame(), config);
    config.width = 1080;
    config.height = 720;
}
Also used : LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)

Example 28 with LwjglApplication

use of com.badlogic.gdx.backends.lwjgl.LwjglApplication in project nhglib by VoidZombie.

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);
}
Also used : LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) Main(io.github.voidzombie.tests.Main)

Example 29 with LwjglApplication

use of com.badlogic.gdx.backends.lwjgl.LwjglApplication 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);
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) Color(com.badlogic.gdx.graphics.Color) ArrayList(java.util.ArrayList) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) BitmapFontWriter(com.badlogic.gdx.tools.bmfont.BitmapFontWriter) FreeTypeFontGenerator(com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator) LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) PixmapPacker(com.badlogic.gdx.graphics.g2d.PixmapPacker) ApplicationAdapter(com.badlogic.gdx.ApplicationAdapter)

Example 30 with LwjglApplication

use of com.badlogic.gdx.backends.lwjgl.LwjglApplication in project TH902 by cn-s3bit.

the class Launcher method main.

/**
 * Entry point.
 */
public static void main(String[] args) {
    Game game = new GameMain(new PlatformRelatedInterfaces() {

        @Override
        public IFont getFont(String fontName, boolean isBold, boolean isItalic, int size) {
            FreetypeFont font = new FreetypeFont();
            font.initialize(fontName, isBold, isItalic, size);
            return font;
        }
    });
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.fullscreen = false;
    config.width = 960;
    config.height = 720;
    config.resizable = false;
    config.title = GameMain.GAME_TITLE;
    config.addIcon("resources/icon32.png", FileType.Internal);
    lwjglApplication = new LwjglApplication(game, config);
}
Also used : PlatformRelatedInterfaces(cn.s3bit.th902.PlatformRelatedInterfaces) Game(com.badlogic.gdx.Game) LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) GameMain(cn.s3bit.th902.GameMain) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) IFont(cn.s3bit.th902.utils.IFont)

Aggregations

LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)41 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)37 GdxTest (com.badlogic.gdx.tests.utils.GdxTest)2 RubeLoaderTest (com.gushikustudios.rube.RubeLoaderTest)2 File (java.io.File)2 AmazingMazeGame (ca.hiphiparray.amazingmaze.AmazingMazeGame)1 GameMain (cn.s3bit.th902.GameMain)1 PlatformRelatedInterfaces (cn.s3bit.th902.PlatformRelatedInterfaces)1 IFont (cn.s3bit.th902.utils.IFont)1 ApplicationAdapter (com.badlogic.gdx.ApplicationAdapter)1 ApplicationListener (com.badlogic.gdx.ApplicationListener)1 Game (com.badlogic.gdx.Game)1 DisplayMode (com.badlogic.gdx.Graphics.DisplayMode)1 LwjglPreferences (com.badlogic.gdx.backends.lwjgl.LwjglPreferences)1 FileHandle (com.badlogic.gdx.files.FileHandle)1 Color (com.badlogic.gdx.graphics.Color)1 PixmapPacker (com.badlogic.gdx.graphics.g2d.PixmapPacker)1 FreeTypeFontGenerator (com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator)1 BitmapFontWriter (com.badlogic.gdx.tools.bmfont.BitmapFontWriter)1 Settings (com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings)1