Java 类com.badlogic.gdx.backends.lwjgl.LwjglFiles 实例源码

项目:MMORPG_Prototype    文件:HeadlessServerLauncher.java   
public static void main(String[] args)
  {
SpringApplication.run(HeadlessServerLauncher.class, args);

    ServerSettings.isHeadless = true;
    LwjglNativesLoader.load();
Gdx.files = new LwjglFiles();
HeadlessNativesLoader.load();
MockGraphics mockGraphics = new MockGraphics();
Gdx.graphics = mockGraphics;
HeadlessNet headlessNet = new HeadlessNet();
Gdx.net = headlessNet;
Gdx.gl = new NullGL20();
Gdx.gl20 = new NullGL20();
Gdx.gl30 = new NullGL30();
HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration();
new HeadlessApplication(new GameServer(), config);
  }
项目:cachebox3.0    文件:MainWindow.java   
@Override
public void init() {

    if (Gdx.net != null) return;
    BuildInfo.setTestBuildInfo("JUnitTest");
    Gdx.net = new LwjglNet();
    Gdx.files = new LwjglFiles();
    Gdx.app = new DummyLogApplication() {
        @Override
        public ApplicationType getType() {
            return ApplicationType.HeadlessDesktop;
        }
    };
    Gdx.app.setApplicationLogger(new LwjglApplicationLogger());


}
项目:mini2Dx    文件:UiThemeWriter.java   
public static void main(String [] args) {
    Gdx.files = new LwjglFiles();

    UiTheme theme = new UiTheme();
    theme.setId(UiTheme.DEFAULT_STYLE_ID);
    theme.putFont("default", "example.ttf");

    ButtonStyleRuleset buttonRuleset = new ButtonStyleRuleset();
    ButtonStyleRule styleRule = new ButtonStyleRule();
    styleRule.setAction("");
    styleRule.setDisabled("");
    styleRule.setFont("");
    styleRule.setHover("");
    styleRule.setNormal("");
    styleRule.setTextColor("");

    buttonRuleset.putStyleRule(ScreenSize.XS, styleRule);
    theme.putButtonStyleRuleset(UiTheme.DEFAULT_STYLE_ID, buttonRuleset);

    try {
        Mdx.json.toJson(Gdx.files.absolute("/tmp/theme.json"), theme);
    } catch (SerializationException e) {
        e.printStackTrace();
    }
}
项目:Onyx    文件:DesktopLauncher.java   
public static void main(String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

// Since Gdx.files is only set up once we launch an application and we
// therefore cant use that we need to provide Configs with a Files instance for
// loading our configurations.
Configs.setFiles(new LwjglFiles());

setupDisplay(config);

new LwjglApplication(new OnyxGame(), config);
   }
项目:cachebox3.0    文件:TestUtils.java   
public static void initialGdx() {
    if (Gdx.net != null) return;
    BuildInfo.setTestBuildInfo("JUnitTest");
    Gdx.net = new LwjglNet();
    Gdx.files = new LwjglFiles();
    Gdx.app = new DummyLogApplication() {
        @Override
        public ApplicationType getType() {
            return ApplicationType.HeadlessDesktop;
        }
    };
    Gdx.app.setApplicationLogger(new LwjglApplicationLogger());
    CB.WorkPath = "!!!";
}
项目:dice-heroes    文件:Generator.java   
private static void renamePrefixes(String path, String prefix, String newPrefix) {
    Files files = new LwjglFiles();
    for (FileHandle fileHandle : files.local(path).list()) {
        if (fileHandle.name().startsWith(prefix)) {
            String newName = newPrefix + fileHandle.name().substring(prefix.length());
            println(fileHandle.name() + " -> " + newName);
            fileHandle.sibling(newName).write(fileHandle.read(), false);
            fileHandle.delete();
        }
    }
}
项目:fabulae    文件:DesktopLauncher.java   
public static void main (String[] arg) {

    boolean shouldPack = arg.length == 1 && "pack".equals(arg[0]);
    boolean shouldCompile = arg.length == 2 && "compile".equals(arg[0]);

    if (shouldCompile) {
        String folderName = arg[1];
        ScriptCompiler compiler = new ScriptCompiler(folderName);
        compiler.run();
        return;
    }

    if (shouldPack) {
        Settings settings = new Settings();
        settings.maxHeight = 2048;
        settings.maxWidth = 4096;
        TexturePacker.process("bin/images", "bin", "uiStyle");
        TexturePacker.process(settings, "bin/modules/showcase/ui/images/startGameMenu", "bin/modules/showcase/ui/", "startGameMenuStyle");
        TexturePacker.process(settings, "bin/modules/showcase/ui/images/partyCreation", "bin/modules/showcase/ui/", "partyCreationStyle");
        TexturePacker.process("bin/modules/showcase/ui/images/game", "bin/modules/showcase/ui/", "uiStyle");
        TexturePacker.process("bin/modules/showcase/perks/images/small", "bin/modules/showcase/perks/images/", "perkImages");
        TexturePacker.process("bin/modules/showcase/spells/images/small", "bin/modules/showcase/spells/images/", "spellImages");
    }

    Configuration.createConfiguration(new LwjglFiles());

    LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
    cfg.title = "Fabulae";
    cfg.width = Configuration.getScreenWidth();
    cfg.height = Configuration.getScreenHeight();
    cfg.fullscreen = Configuration.isFullscreen();

    new LwjglApplication(new FishchickenGame(), cfg).setLogLevel(Application.LOG_DEBUG);
}
项目:gdx-texture-packer-gui    文件:LoggerUtils.java   
public static void setupExternalFileOutput() {
    try {
        Date currentDate = new Date();
        long currentTime = currentDate.getTime();
        String fileName = new SimpleDateFormat("yyMMddhhmm").format(currentDate) + ".log";
        File logFile = new File(LwjglFiles.externalPath + AppConstants.LOGS_DIR + File.separator + fileName);
        logFile.getParentFile().mkdirs();
        for (File oldLogFile : logFile.getParentFile().listFiles((FileFilter)new SuffixFileFilter(LOG_FILE_EXTENSION))) {
            long lastModified = oldLogFile.lastModified();
            if (currentTime - lastModified > EXPIRATION_THRESHOLD) {
                try { oldLogFile.delete(); } catch (SecurityException ignored) { }
            }
        }
        FileOutputStream logFileOutputStream = new FileOutputStream(logFile);
        System.setOut(new PrintStream(new OutputStreamMultiplexer(
                new FileOutputStream(FileDescriptor.out),
                logFileOutputStream
        )));
        System.setErr(new PrintStream(new OutputStreamMultiplexer(
                new FileOutputStream(FileDescriptor.err),
                logFileOutputStream
        )));
        System.out.println("Version: " + AppConstants.version);
        System.out.println("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch"));
        System.out.println("JRE: " + System.getProperty("java.version") + " " + System.getProperty("java.vendor"));
        System.out.println("External log file: " + logFile.getAbsolutePath());
    } catch (FileNotFoundException e) {
        System.err.println("Can't setup logging to external file.");
        e.printStackTrace();
    }
}
项目:gdx-texture-packer-gui    文件:WindowParamsPersistingApplicationWrapper.java   
private void loadWindowParams(LwjglApplicationConfiguration configuration) {
    FileHandle file = new FileHandle(LwjglFiles.externalPath + configuration.preferencesDirectory + "/window_params.xml");
    if (!file.exists()) return;

    DisplayMode displayMode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
    int screenWidth = displayMode.getWidth();
    int screenHeight = displayMode.getHeight();

    Preferences prefs = new LwjglPreferences(file);
    configuration.width = MathUtils.clamp(prefs.getInteger("width", configuration.width), 320, screenWidth);
    configuration.height = MathUtils.clamp(prefs.getInteger("height", configuration.height), 320, screenHeight);
    configuration.x = MathUtils.clamp(prefs.getInteger("x", configuration.x), 0, screenWidth - configuration.width);
    configuration.y = MathUtils.clamp(prefs.getInteger("y", configuration.y), 0, screenHeight - configuration.height);
}
项目:ead    文件:GenerateFieldClasses.java   
public static void main(String[] args) {
    System.out.println("Generating Field classes ...");
    System.out.println();
    Files files = new LwjglFiles();
    Json json = new Json();
    FileHandle dir = files.internal(REPOCOMPONENTS_MAIN_PATH);
    // Generate fields classes for all repo classes
    buildCodeForAllClasses(files, json, dir, SCHEMAX_REPO_PACKAGE,
            EDITOR_SCHEMA_DESTFOLDER);
}
项目:ead    文件:GenerateBindings.java   
public static void generateBindingsFile(String schemaFolder,
        String schemaPackage, String schemaBindingsLocation) {
    Files files = new LwjglFiles();
    String bindings = "[\n  ";
    bindings += addBindings(files.internal(schemaFolder + schemaPackage),
            schemaFolder);
    int lastComma = bindings.lastIndexOf(',');
    if (lastComma > 0) {
        bindings = bindings.substring(0, lastComma);
    }
    bindings += "\n]";
    new FileHandle(files.internal(schemaBindingsLocation).file())
            .writeString(bindings, false);
}
项目:shadow-engine    文件:ConverterLauncher.java   
public static void main(String[] args) {
    if (args.length != 2) {
        System.err.println("Shadow Engine TMX to SMF converter");
        System.err.println("Version: Don't even ask me.");
        System.err.println("Usage: <process> <input> <output>");
        return;
    }

    LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
    cfg.title = "shadow-tmx-to-smf";
    cfg.useGL30 = false;
    cfg.width = 600;
    cfg.height = 480;

    Files files = new LwjglFiles();

    FileHandle input = files.internal(args[0]);
    if (!input.exists()) {
        input = files.absolute(args[0]);
    }
    if (input != null && !input.exists()) {
        System.err.println("Input file doesn't exist internally nor absolutely!");
        return;
    }

    FileHandle output = files.absolute(args[1]);

    Converter converter = new Converter(input, output);

    Converter.list.add(converter);
    Converter.convertOnly = true;

    BackendHelper.backend = new LWJGLBackend(cfg);
    new LwjglApplication(new Shadow(), cfg);
}
项目:mini2Dx    文件:DesktopPlayerDataTest.java   
@Before
public void setUp() {
    Gdx.files = new LwjglFiles();
    Mdx.json = new JsonSerializer();
    Mdx.xml = new DesktopXmlSerializer();
    Mdx.di = new DesktopDependencyInjection();
    desktopData = new DesktopPlayerData(TEST_IDENTIFIER);

    createTestObjects();
}
项目:c2d-engine    文件:C2dDesktop.java   
public TestList() {
    setLayout(new BorderLayout());


    final JList list = new JList(C2dTests.getNames());
    final JButton button = new JButton("Run Test");
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);

    list.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent event) {
            if (event.getClickCount() == 2) button.doClick();
        }
    });

    final Preferences prefs = new LwjglPreferences(new FileHandle(new LwjglFiles().getExternalStoragePath() + ".prefs/c2d-tests"));
    list.setSelectedValue(prefs.getString("last", null), true);

    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String testName = (String) list.getSelectedValue();
            Engine test = C2dTests.newTest(testName);
            LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
            config.fullscreen = false;
            config.width = (int) Engine.getWidth();
            config.height = (int) Engine.getHeight();
            config.title = testName;
            config.vSyncEnabled = true;

            prefs.putString("last", testName);
            prefs.flush();

            new LwjglApplication(test, config);
        }
    });

    add(pane, BorderLayout.CENTER);
    add(button, BorderLayout.SOUTH);
}
项目:gaiasky    文件:TGASHYGToBinary.java   
public static void main(String[] args) {
    TGASHYGDataProvider tgashyg = new TGASHYGDataProvider();
    TGASHYGDataProvider.setDumpToDisk(true, "bin");
    tgashyg.setParallaxOverError(14.0);

    try {
        // Assets location
        String ASSETS_LOC = (System.getProperty("assets.location") != null ? System.getProperty("assets.location") : "");

        Gdx.files = new LwjglFiles();

        // Thread idx
        ThreadIndexer.initialize(new SingleThreadIndexer());

        // Sys utils
        SysUtilsFactory.initialize(new DesktopSysUtilsFactory());

        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());

        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());

        ConfInit.initialize(new DesktopConfInit(new FileInputStream(new File(ASSETS_LOC + "conf/global.properties")), new FileInputStream(new File(ASSETS_LOC + "data/dummyversion"))));

        I18n.initialize(new FileHandle(ASSETS_LOC + "i18n/gsbundle"));

        ThreadLocalFactory.initialize(new SingleThreadLocalFactory());

        EventManager.instance.subscribe(new TGASHYGToBinary(), Events.POST_NOTIFICATION, Events.JAVA_EXCEPTION);

        tgashyg.loadData("nofile", 1);

    } catch (Exception e) {
        Logger.error(e);
    }

}
项目:gaiasky    文件:HYGToBinary.java   
public static void main(String[] args) {
    HYGToBinary hyg = new HYGToBinary();

    try {
        // Assets location
        String ASSETS_LOC = (System.getProperty("assets.location") != null ? System.getProperty("assets.location") : "");

        Gdx.files = new LwjglFiles();

        // Sys utils
        SysUtilsFactory.initialize(new DesktopSysUtilsFactory());

        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());

        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());

        ConfInit.initialize(new DesktopConfInit(new FileInputStream(new File(ASSETS_LOC + "conf/global.properties")), new FileInputStream(new File(ASSETS_LOC + "data/dummyversion"))));

        I18n.initialize(new FileHandle(ASSETS_LOC + "i18n/gsbundle"));

        ThreadLocalFactory.initialize(new SingleThreadLocalFactory());

        GlobalConf.data.LIMIT_MAG_LOAD = 20;

        EventManager.instance.subscribe(hyg, Events.POST_NOTIFICATION, Events.JAVA_EXCEPTION);

        //hyg.compareCSVtoBinary(fileIn, fileOut);

        hyg.convertToBinary(fileIn, fileInPm, fileOut);

    } catch (Exception e) {
        Logger.error(e);
    }

}