コード例 #1
0
  @Override
  public void create() {
    skin = new Skin(Gdx.files.internal(SKIN));

    EditorLogger.setDebug();
    EditorLogger.debug("CREATE");
    Ctx.project = new Project();
    Ctx.msg = new Message(skin);
    Ctx.assetManager = new EditorAssetManager();

    scnEditor = new ScnEditor(skin);
    skin.getFont("default-font").getData().markupEnabled = true;

    /** * STAGE SETUP ** */
    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);

    // RIGHT PANEL
    ScenePanel scenePanel = new ScenePanel(skin);
    ActorPanel actorPanel = new ActorPanel(skin);

    Table rightPanel = new Table();
    rightPanel.top().left();
    //		rightPanel.add(scenePanel).expand().fill();
    //		rightPanel.row();
    rightPanel.add(actorPanel).expand().fill();

    SplitPane splitPaneRight = new SplitPane(scnEditor, rightPanel, false, skin);

    // LEFT PANEL
    ProjectPanel projectPanel = new ProjectPanel(skin);
    //		AssetPanel assetPanel = new AssetPanel(skin);
    Image img = new Image(Ctx.assetManager.getIcon("title"));
    img.setScaling(Scaling.none);
    img.setAlign(Align.left);

    Table leftPanel = new Table();
    leftPanel.top().left().padLeft(10);
    leftPanel.add(img).expand().fill().padBottom(20).padTop(20).padLeft(20);
    leftPanel.row();
    leftPanel.add(new ProjectToolbar(skin)).expandX().fill();
    leftPanel.row();
    leftPanel.add(projectPanel).expand().fill();
    leftPanel.row();
    leftPanel.add(scenePanel).expand().fill();

    SplitPane splitPaneLeft = new SplitPane(leftPanel, splitPaneRight, false, skin);
    splitPaneLeft.setFillParent(true);
    splitPaneLeft.setSplitAmount(0.3f);
    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));
      } catch (Exception e) {
        EditorLogger.debug("Error loading last project: " + e.getMessage());
        Ctx.project.closeProject();
        e.printStackTrace();
      }
    }

    stage.setScrollFocus(scnEditor.getScnWidget());
    stage.setKeyboardFocus(scnEditor.getScnWidget());
  }
コード例 #2
0
  @Override
  public void resize(int width, int height) {
    EditorLogger.debug("RESIZE - w:" + width + " h:" + height);

    stage.getViewport().update(width, height, true);
  }