use of com.bladecoder.engineeditor.ui.ProjectPanel in project bladecoder-adventure-engine by bladecoder.
the class Editor method create.
@Override
public void create() {
Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2), Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));
skin = new BladeSkin(Gdx.files.internal(SKIN));
VisUI.load();
FileChooser.setDefaultPrefsName("com.bladecoder.engineeditor.filechooser");
/**
* STAGE SETUP **
*/
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
setCtx();
Message.init(skin);
scnEditor = new ScnEditor(skin);
scnEditor.setBackground("background");
skin.getFont("default-font").getData().markupEnabled = true;
// RIGHT PANEL
ScenePanel scenePanel = new ScenePanel(skin);
ActorPanel actorPanel = new ActorPanel(skin);
Table rightPanel = new Table(skin);
rightPanel.top().left();
rightPanel.add(actorPanel).expand().fill().left();
rightPanel.setBackground("background");
SplitPane splitPaneRight = new SplitPane(scnEditor, rightPanel, false, skin);
splitPaneRight.setSplitAmount(0.75f);
// LEFT PANEL
ProjectPanel projectPanel = new ProjectPanel(skin);
Image img = new Image(Ctx.assetManager.getIcon("title"));
img.setScaling(Scaling.none);
img.setAlign(Align.left);
Table leftPanel = new Table(skin);
leftPanel.top().left().padLeft(10);
leftPanel.add(img).expand().fill().padBottom(20).padTop(20).padLeft(0).left();
leftPanel.row();
leftPanel.add(new ProjectToolbar(skin)).expandX().fill().left();
leftPanel.row();
leftPanel.add(projectPanel).expand().fill().left();
leftPanel.row();
leftPanel.add(scenePanel).expand().fill().left();
leftPanel.setBackground("background");
SplitPane splitPaneLeft = new SplitPane(leftPanel, splitPaneRight, false, skin);
splitPaneLeft.setFillParent(true);
splitPaneLeft.setSplitAmount(0.25f);
stage.addActor(splitPaneLeft);
// LOAD LAST OPEN PROJECT
String lastProject = Ctx.project.getEditorConfig().getProperty(Project.LAST_PROJECT_PROP, "");
if (!lastProject.isEmpty() && new File(lastProject).exists()) {
try {
EditorLogger.debug("Loading last project: " + lastProject);
Ctx.project.loadProject(new File(lastProject));
if (!Ctx.project.checkVersion()) {
new Dialog("Update Engine", skin) {
protected void result(Object object) {
if (((Boolean) object).booleanValue()) {
try {
Ctx.project.updateEngineVersion();
Message.showMsg(getStage(), "Project successfully updated.", 3);
} catch (IOException e1) {
String msg = "Something went wrong while updating the engine.\n\n" + e1.getClass().getSimpleName() + " - " + e1.getMessage();
Message.showMsgDialog(getStage(), "Error", msg);
EditorLogger.error(msg, e1);
}
}
}
}.text("Your game uses an old (" + Ctx.project.getProjectBladeEngineVersion() + ") Engine version. Do you want to update the engine?").button("Yes", true).button("No", false).key(Keys.ENTER, true).key(Keys.ESCAPE, false).show(stage);
}
} catch (Exception e) {
EditorLogger.error("Error loading last project.", e);
Ctx.project.closeProject();
}
}
stage.setScrollFocus(scnEditor.getScnWidget());
stage.setKeyboardFocus(scnEditor.getScnWidget());
// TooltipManager.getInstance().instant();
TooltipManager.getInstance().initialTime = 0.2f;
TooltipManager.getInstance().hideAll();
TooltipManager.getInstance().subsequentTime = 0.2f;
}
Aggregations