Exemplo n.º 1
0
  public void init() {

    scriptUI.runCompiler(TestNode.CollisionData.class);
    setUpControlMenu();
    disp.getJFrame().setJMenuBar(menuBar);
    disp.setTitle("Snap2D PhysicsUI - alpha v.0.2");
    disp.show();
    initWorld();
    rc.setTargetFPS(30);
    rc.setTargetTPS(30);
    rc.setRenderOp(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    rc.startRenderLoop();
  }
Exemplo n.º 2
0
  public void addEntity(final PhysicsEntity pe, final int pos) {

    // rc.addRenderable(pe, pos);
    manager.register(pe, collListener);
    entities.add(pe);
    rc.addRenderable(pe, 1);
  }
Exemplo n.º 3
0
  public void showViewUI() {

    if (!isDialogShowing) {
      rc.setRenderActive(false);
      new ViewEntityUI(new PUICallback(), entities).setVisible(true);
      isDialogShowing = true;
    }
  }
Exemplo n.º 4
0
  public void showEntityUI() {

    if (scriptUI.getScriptProgram().findFunction(TestNode.COLL_FUNC_NAME) == null) {
      JOptionPane.showMessageDialog(null, "Can't find script function: " + TestNode.COLL_FUNC_NAME);
      return;
    }

    if (!isDialogShowing) {
      rc.setRenderActive(false);
      new AddEntityUI().setVisible(true);
      isDialogShowing = true;
    }
  }
Exemplo n.º 5
0
  PhysicsUI() {

    GraphicsConfig config = GraphicsConfig.getDefaultSystemConfig();
    config.set(Property.USE_OPENGL, "true");
    config.set(Property.USE_LINUX_XRENDER, "false");
    config.set(Property.SNAP2D_PRINT_RENDER_STAT, "false");
    disp = new Display(800, 600, Type.WINDOWED, config);
    rc = disp.getRenderControl(3);
    rc.addRenderable(new Background(), 0);
    rc.addRenderable(new InfoDisplay(), 1);
    registerKeyClient(
        new KeyEventClient() {

          @Override
          public void processKeyEvent(final KeyEvent e) {

            if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_SPACE) {
              rc.setDisableUpdates(rc.isUpdating());
            }
          }
        });

    registerMouseClient(new EntityClickMovement());
  }