示例#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();
  }
示例#2
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());
  }
示例#3
0
  public void initWorld() {

    world = new World2D(0, disp.getSize().height, disp.getSize().width, disp.getSize().height, 1);
  }