Search in sources :

Example 1 with ProjectData

use of com.ray3k.skincomposer.data.ProjectData in project skin-composer by raeleus.

the class Main method initDefaults.

private void initDefaults() {
    if (Utils.isMac())
        System.setProperty("java.awt.headless", "true");
    skin.getFont("font").getData().markupEnabled = true;
    // copy defaults.json to temp folder if it doesn't exist
    FileHandle fileHandle = Gdx.files.local("texturepacker/defaults.json");
    if (!fileHandle.exists()) {
        Gdx.files.internal("defaults.json").copyTo(fileHandle);
    }
    // copy preview fonts to preview fonts folder if they do not exist
    fileHandle = Gdx.files.local("preview fonts/IBMPlexSerif-Medium.ttf");
    if (!fileHandle.exists()) {
        Gdx.files.internal("preview fonts/IBMPlexSerif-Medium.ttf").copyTo(fileHandle);
    }
    fileHandle = Gdx.files.local("preview fonts/Pacifico-Regular.ttf");
    if (!fileHandle.exists()) {
        Gdx.files.internal("preview fonts/Pacifico-Regular.ttf").copyTo(fileHandle);
    }
    fileHandle = Gdx.files.local("preview fonts/PressStart2P-Regular.ttf");
    if (!fileHandle.exists()) {
        Gdx.files.internal("preview fonts/PressStart2P-Regular.ttf").copyTo(fileHandle);
    }
    fileHandle = Gdx.files.local("preview fonts/SourceSansPro-Regular.ttf");
    if (!fileHandle.exists()) {
        Gdx.files.internal("preview fonts/SourceSansPro-Regular.ttf").copyTo(fileHandle);
    }
    ibeamListener = new IbeamListener();
    projectData = new ProjectData();
    projectData.setMain(this);
    projectData.randomizeId();
    projectData.setMaxUndos(30);
    dialogFactory = new DialogFactory(this);
    undoableManager = new UndoableManager(this);
    desktopWorker.attachLogListener();
    desktopWorker.sizeWindowToFit(800, 800, 50, Gdx.graphics);
    desktopWorker.centerWindow(Gdx.graphics);
    desktopWorker.setCloseListener(() -> {
        dialogFactory.showCloseDialog();
        return false;
    });
    loadingAnimation = new AnimatedDrawable(.05f);
    loadingAnimation.addDrawable(skin.getDrawable("loading_0"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_1"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_2"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_3"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_4"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_5"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_6"));
    loadingAnimation.addDrawable(skin.getDrawable("loading_7"));
    projectData.getAtlasData().clearTempData();
    handListener = new HandListener();
    tooltipManager = new TooltipManager();
    tooltipManager.animations = false;
    tooltipManager.initialTime = .4f;
    tooltipManager.resetTime = 0.0f;
    tooltipManager.subsequentTime = 0.0f;
    tooltipManager.hideAll();
    tooltipManager.instant();
}
Also used : DialogFactory(com.ray3k.skincomposer.dialog.DialogFactory) FileHandle(com.badlogic.gdx.files.FileHandle) TooltipManager(com.badlogic.gdx.scenes.scene2d.ui.TooltipManager) ProjectData(com.ray3k.skincomposer.data.ProjectData)

Aggregations

FileHandle (com.badlogic.gdx.files.FileHandle)1 TooltipManager (com.badlogic.gdx.scenes.scene2d.ui.TooltipManager)1 ProjectData (com.ray3k.skincomposer.data.ProjectData)1 DialogFactory (com.ray3k.skincomposer.dialog.DialogFactory)1