Example usage for com.badlogic.gdx.files FileHandle equals

List of usage examples for com.badlogic.gdx.files FileHandle equals

Introduction

In this page you can find the example usage for com.badlogic.gdx.files FileHandle equals.

Prototype

@Override
    public boolean equals(Object obj) 

Source Link

Usage

From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.ScreenGame.java

License:Open Source License

/**
 * @param cNewMusic should be a file that can be read by GDX
 *//*w w  w .j ava 2s. co  m*/
public void setNewLoopMusic(final FileHandle pNewMusicFile) {
    if (pNewMusicFile.equals(loopMusicFile)) {
        return;
    }

    boolean bWasPlaying = loopMusic.isPlaying();
    loopMusic.stop();
    loopMusic.dispose();

    loopMusicFile = pNewMusicFile;
    loopMusic = Gdx.audio.newMusic(pNewMusicFile);
    loopMusic.setLooping(true);

    if (bWasPlaying) {
        loopMusic.play();
    }
}

From source file:com.kotcrab.vis.ui.widget.file.FileChooser.java

License:Apache License

/**
 * Changes file chooser active directory.
 * Warning: To avoid hanging listing directory is performed asynchronously. In case of passing invalid file handle
 * file chooser will fallback to default one.
 *//*from w w  w. ja v a  2s. c  o  m*/
@Override
public void setDirectory(FileHandle directory, HistoryPolicy historyPolicy) {
    if (directory.equals(currentDirectory))
        return;
    if (historyPolicy == HistoryPolicy.ADD)
        historyManager.historyAdd();

    currentDirectory = directory;
    iconProvider.directoryChanged(directory);

    rebuildFileList();

    if (historyPolicy == HistoryPolicy.CLEAR)
        historyManager.historyClear();

    updateFavoriteFolderButton();
}

From source file:com.ray3k.skincomposer.data.ProjectData.java

License:Open Source License

private void moveImportedFiles(FileHandle oldSave, FileHandle newSave) {
    FileHandle tempImportFolder = Gdx.files.local("temp/" + getId() + "_data/");
    FileHandle localImportFolder;
    if (oldSave != null) {
        localImportFolder = oldSave.sibling(oldSave.nameWithoutExtension() + "_data/");
    } else {/* ww  w . j a  v  a2 s .  c  o m*/
        localImportFolder = null;
    }
    FileHandle targetFolder = newSave.sibling(newSave.nameWithoutExtension() + "_data/");
    targetFolder.mkdirs();

    for (DrawableData drawableData : atlasData.getDrawables()) {
        if (drawableData.file.exists()) {
            //drawable files in the temp folder
            if (drawableData.file.parent().equals(tempImportFolder)) {
                drawableData.file.moveTo(targetFolder);
                drawableData.file = targetFolder.child(drawableData.file.name());
            }
            //drawable files in the folder next to the old save
            else if (localImportFolder != null && !localImportFolder.equals(targetFolder)
                    && drawableData.file.parent().equals(localImportFolder)) {
                drawableData.file.copyTo(targetFolder);
                drawableData.file = targetFolder.child(drawableData.file.name());
            }
        }
    }

    for (FontData fontData : jsonData.getFonts()) {
        if (fontData.file.exists()) {
            //font files in the temp folder
            if (fontData.file.parent().equals(tempImportFolder)) {
                fontData.file.moveTo(targetFolder);
                fontData.file = targetFolder.child(fontData.file.name());
            }
            //font files in the data folder next to the old save
            else if (localImportFolder != null && !localImportFolder.equals(targetFolder)
                    && fontData.file.parent().equals(localImportFolder)) {
                fontData.file.copyTo(targetFolder);
                fontData.file = targetFolder.child(fontData.file.name());
            }
        }
    }
}