public FileHandle sibling (String name) { name = name.replace('\\', '/'); if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return Gdx.files.getFileHandle(new File(file.getParent(), name).getPath(), type); //this way we can find the sibling even if it's inside the obb }
@Override public FileHandle sibling(String name) { if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return Gdx.files.getFileHandle(new File(file.getParent(), name).getPath(), type); //this way we can find the sibling even if it's not inside the obb }
public FileHandle sibling (String name) { name = name.replace('\\', '/'); if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return Gdx.files.getFileHandle(new File(file.getParent(), name).getPath(), type); //this way we can find the sibling even if it's inside the obb }
@Override public FileHandle sibling(String name) { if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return Gdx.files.getFileHandle(new File(file.getParent(), name).getPath(), type); //this way we can find the sibling even if it's not inside the obb }
static void setIcon(long windowHandle, String[] imagePaths, Files.FileType imageFileType) { if (SharedLibraryLoader.isMac) return; Pixmap[] pixmaps = new Pixmap[imagePaths.length]; for (int i = 0; i < imagePaths.length; i++) { pixmaps[i] = new Pixmap(Gdx.files.getFileHandle(imagePaths[i], imageFileType)); } setIcon(windowHandle, pixmaps); for (Pixmap pixmap : pixmaps) { pixmap.dispose(); } }
static void setIcon(long windowHandle, String[] imagePaths, Files.FileType imageFileType) { if (SharedLibraryLoader.isMac) return; Pixmap[] pixmaps = new Pixmap[imagePaths.length]; for (int i = 0; i < imagePaths.length; i++) { pixmaps[i] = new Pixmap(Gdx.files.getFileHandle(imagePaths[i], imageFileType)); } setIcon(windowHandle, pixmaps); for (Pixmap pixmap : pixmaps) { pixmap.dispose(); } }
@Override public void create () { Gdx.input.setInputProcessor(new InputAdapter() { public boolean touchDown (int x, int y, int pointer, int newParam) { renderMode = (renderMode + 1) % 6; return false; } }); spriteBatch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/badlogic.jpg")); logoSprite = new Sprite(texture); logoSprite.setColor(1, 1, 1, 0.6f); logoSprite.setBounds(50, 100, 400, 100); font = new BitmapFont(Gdx.files.getFileHandle("data/verdana39.fnt", FileType.Internal), Gdx.files.getFileHandle( "data/verdana39.png", FileType.Internal), false); cache = font.newFontCache(); layout = new GlyphLayout(); }
/** 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 void create () { if (spriteBatch != null) return; spriteBatch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); lineColor = com.badlogic.gdx.graphics.Color.valueOf("636363"); worldCamera = new OrthographicCamera(); textCamera = new OrthographicCamera(); pixelsPerMeter = new NumericValue(); pixelsPerMeter.setValue(1.0f); pixelsPerMeter.setAlwaysActive(true); zoomLevel = new NumericValue(); zoomLevel.setValue(1.0f); zoomLevel.setAlwaysActive(true); deltaMultiplier = new NumericValue(); deltaMultiplier.setValue(1.0f); deltaMultiplier.setAlwaysActive(true); backgroundColor = new GradientColorValue(); backgroundColor.setColors(new float[] {0f, 0f, 0f}); font = new BitmapFont(Gdx.files.getFileHandle("default.fnt", FileType.Internal), Gdx.files.getFileHandle("default.png", FileType.Internal), true); effectPanel.newExampleEmitter("Untitled", true); // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png"); OrthoCamController orthoCamController = new OrthoCamController (worldCamera); Gdx.input.setInputProcessor(new InputMultiplexer(orthoCamController, this)); }
@Override public void create () { if (spriteBatch != null) return; spriteBatch = new SpriteBatch(); Matrix4 transform = new Matrix4(); transform.setToTranslation(0, Gdx.graphics.getHeight(), 0); transform.mul(new Matrix4().setToScaling(1, -1, 1)); spriteBatch.setTransformMatrix(transform); pixS1 = new Pixmap(Gdx.files.getFileHandle("data/test4.png", Files.FileType.Internal)); pixS2 = new Pixmap(Gdx.files.getFileHandle("data/test3.png", Files.FileType.Internal)); pixD = new Pixmap(512, 1024, Pixmap.Format.RGBA8888); pixD.setBlending(Pixmap.Blending.SourceOver); pixD.setFilter(Pixmap.Filter.NearestNeighbour); pixD.drawPixmap(pixS1, 0, 0, 38, 76, 0, 0, 512, 1024); pixD.drawPixmap(pixS2, 0, 0, 38, 76, 0, 0, 512, 1024); logoSprite = new Sprite(new Texture(pixD)); logoSprite.flip(false, true); pixS1.dispose(); pixS2.dispose(); pixD.dispose(); }
public void create () { if (spriteBatch != null) return; spriteBatch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); lineColor = com.badlogic.gdx.graphics.Color.valueOf("636363"); worldCamera = new OrthographicCamera(); textCamera = new OrthographicCamera(); pixelsPerMeter = new NumericValue(); pixelsPerMeter.setValue(1.0f); pixelsPerMeter.setAlwaysActive(true); zoomLevel = new NumericValue(); zoomLevel.setValue(1.0f); zoomLevel.setAlwaysActive(true); deltaMultiplier = new NumericValue(); deltaMultiplier.setValue(1.0f); deltaMultiplier.setAlwaysActive(true); backgroundColor = new GradientColorValue(); backgroundColor.setColors(new float[] {0f, 0f, 0f}); font = new BitmapFont(Gdx.files.getFileHandle("default.fnt", FileType.Internal), Gdx.files.getFileHandle("default.png", FileType.Internal), true); effectPanel.newExampleEmitter("Untitled", true); // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png"); OrthoCamController orthoCamController = new OrthoCamController (worldCamera); Gdx.input.setInputProcessor(new InputMultiplexer(orthoCamController, this)); }
ByteBuffer[] icons = new ByteBuffer[config.iconPaths.size]; for (int i = 0, n = config.iconPaths.size; i < n; i++) { Pixmap pixmap = new Pixmap(Gdx.files.getFileHandle(config.iconPaths.get(i), config.iconFileTypes.get(i))); if (pixmap.getFormat() != Format.RGBA8888) { Pixmap rgba = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), Format.RGBA8888);
ByteBuffer[] icons = new ByteBuffer[config.iconPaths.size]; for (int i = 0, n = config.iconPaths.size; i < n; i++) { Pixmap pixmap = new Pixmap(Gdx.files.getFileHandle(config.iconPaths.get(i), config.iconFileTypes.get(i))); if (pixmap.getFormat() != Format.RGBA8888) { Pixmap rgba = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), Format.RGBA8888);
@Override public FileHandle newFileHandle (String fileName, FileType type) { return Gdx.files.getFileHandle(fileName, type); }
@Override public FileHandle newFileHandle (File file, FileType type) { return Gdx.files.getFileHandle(file.getPath(), type); }
@Override public void create () { sound = Gdx.audio.newSound(Gdx.files.getFileHandle("data/shotgun.ogg", FileType.Internal));
static void setIcon(long windowHandle, String[] imagePaths, Files.FileType imageFileType) { if (SharedLibraryLoader.isMac) return; Pixmap[] pixmaps = new Pixmap[imagePaths.length]; for (int i = 0; i < imagePaths.length; i++) { pixmaps[i] = new Pixmap(Gdx.files.getFileHandle(imagePaths[i], imageFileType)); } setIcon(windowHandle, pixmaps); for (Pixmap pixmap : pixmaps) { pixmap.dispose(); } }
public PlayerEngineSoundEffect (TrackProgressData progressData) { feLoad = FIS.load(Gdx.files.getFileHandle("data/audio/car-engine/fuzzy/engineLoad.fcl", FileType.Internal).read(), true); load = 0; throttle = 0; soundset = new EngineF40(progressData); }
@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); } });