/** Constructs a new BitmapFont from the given {@link BitmapFontData} and array of {@link TextureRegion}. If the TextureRegion * is null or empty, the image path(s) will be read from the BitmapFontData. The dispose() method will not dispose the texture * of the region(s) if the regions array is != null and not empty. * @param integer If true, rendering positions will be at integer values to avoid filtering artifacts. */ public BitmapFont (BitmapFontData data, Array<TextureRegion> pageRegions, boolean integer) { this.flipped = data.flipped; this.data = data; this.integer = integer; if (pageRegions == null || pageRegions.size == 0) { if (data.imagePaths == null) throw new IllegalArgumentException("If no regions are specified, the font data must have an images path."); // Load each path. int n = data.imagePaths.length; regions = new Array(n); for (int i = 0; i < n; i++) { FileHandle file; if (data.fontFile == null) file = Gdx.files.internal(data.imagePaths[i]); else file = Gdx.files.getFileHandle(data.imagePaths[i], data.fontFile.type()); regions.add(new TextureRegion(new Texture(file, false))); } ownsTexture = true; } else { regions = pageRegions; ownsTexture = false; } cache = newFontCache(); load(data); }
/** Constructs a new BitmapFont from the given {@link BitmapFontData} and array of {@link TextureRegion}. If the TextureRegion * is null or empty, the image path(s) will be read from the BitmapFontData. The dispose() method will not dispose the texture * of the region(s) if the regions array is != null and not empty. * @param integer If true, rendering positions will be at integer values to avoid filtering artifacts. */ public BitmapFont (BitmapFontData data, Array<TextureRegion> pageRegions, boolean integer) { this.flipped = data.flipped; this.data = data; this.integer = integer; if (pageRegions == null || pageRegions.size == 0) { if (data.imagePaths == null) throw new IllegalArgumentException("If no regions are specified, the font data must have an images path."); // Load each path. int n = data.imagePaths.length; regions = new Array(n); for (int i = 0; i < n; i++) { FileHandle file; if (data.fontFile == null) file = Gdx.files.internal(data.imagePaths[i]); else file = Gdx.files.getFileHandle(data.imagePaths[i], data.fontFile.type()); regions.add(new TextureRegion(new Texture(file, false))); } ownsTexture = true; } else { regions = pageRegions; ownsTexture = false; } cache = newFontCache(); load(data); }
public FileHandleData (FileHandle file) { type = file.type(); path = file.path(); }
@Override public void selected (Array<FileHandle> files) { FileHandle file = files.first(); if (file.name().endsWith(".9")) { String path = file.path() + ".png"; file = Gdx.files.getFileHandle(path, file.type()); } if (!file.name().endsWith(".9.png")) { String path = file.pathWithoutExtension() + ".9.png"; file = Gdx.files.getFileHandle(path, file.type()); } PixmapIO.writePNG(file, ninePatchPixmap); ninePatchPixmap.dispose(); }
public void build (Array<FileHandle> favorites, FileHandle file) { sortingPopupMenu.build(); this.file = file; clearChildren(); addItem(newDirectory); addItem(sortBy); addItem(refresh); addSeparator(); if (file.type() == FileType.Absolute || file.type() == FileType.External) addItem(delete); if (file.type() == FileType.Absolute) { addItem(showInExplorer); if (file.isDirectory()) { if (favorites.contains(file, false)) addItem(removeFromFavorites); else addItem(addToFavorites); } } }
@Override public void selected (Array<FileHandle> file) { FileHandle chosenFile = file.first(); fileChooserHistory.putLastDir(FileChooserHistory.Type.PROJECT, chosenFile.parent()); if (chosenFile.extension().length() == 0) { chosenFile = Gdx.files.getFileHandle(chosenFile.path()+"."+AppConstants.PROJECT_FILE_EXT, chosenFile.type()); } getProject().setProjectFile(chosenFile); projectSerializer.saveProject(project, chosenFile); } });
/** Constructs a new BitmapFont from the given {@link BitmapFontData} and array of {@link TextureRegion}. If the TextureRegion * is null or empty, the image path(s) will be read from the BitmapFontData. The dispose() method will not dispose the texture * of the region(s) if the regions array is != null and not empty. * @param integer If true, rendering positions will be at integer values to avoid filtering artifacts. */ public BitmapFont (BitmapFontData data, Array<TextureRegion> pageRegions, boolean integer) { this.flipped = data.flipped; this.data = data; this.integer = integer; if (pageRegions == null || pageRegions.size == 0) { // Load each path. int n = data.imagePaths.length; regions = new Array(n); for (int i = 0; i < n; i++) { FileHandle file; if (data.fontFile == null) file = Gdx.files.internal(data.imagePaths[i]); else file = Gdx.files.getFileHandle(data.imagePaths[i], data.fontFile.type()); regions.add(new TextureRegion(new Texture(file, false))); } ownsTexture = true; } else { regions = pageRegions; ownsTexture = false; } cache = newFontCache(); load(data); }