Пример #1
0
  @Override
  public void initialize(AppStateManager stateManager, Application application) {
    super.initialize(stateManager, application);
    app = (SimpleApplication) application;
    myWindow = new Container();

    // Put it somewhere that we will see it
    // Note: Lemur GUI elements grow down from the upper left corner.
    myWindow.setLocalTranslation(0, 0, 0);

    myWindow.attachChild(
        LemurHelper.createButton(
            "Singleplayer",
            30,
            82.5f,
            40,
            5,
            20,
            true,
            (Command<Button>)
                (Button source) -> {
                  app.getStateManager().detach(this);
                  app.getStateManager().attach(new SinglePlayerState());
                }));
    myWindow.attachChild(
        LemurHelper.createButton(
            "Multiplayer", 30, 62.5f, 40, 5, 20, false, (Command<Button>) (Button source) -> {}));
    myWindow.attachChild(
        LemurHelper.createButton(
            "Options",
            30,
            42.5f,
            40,
            5,
            20,
            true,
            (Command<Button>)
                (Button source) -> {
                  app.getStateManager().detach(this);
                  app.getStateManager().attach(new OptionsState());
                }));
    myWindow.attachChild(
        LemurHelper.createButton(
            "Exit",
            30,
            22.5f,
            40,
            5,
            20,
            true,
            (Command<Button>)
                (Button source) -> {
                  app.stop();
                }));
    app.getGuiNode().attachChild(myWindow);
  }
Пример #2
0
  @SuppressWarnings("unchecked")
  @Override
  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);

    bulletAppState = new BulletAppState();
    app.getStateManager().attach(bulletAppState);

    StaticWorldHelper.addStaticWorld(
        App.rally.getRootNode(), getPhysicsSpace(), world, App.rally.sky.ifShadow);

    cb = new CarBuilder();
    cb.addCar(getPhysicsSpace(), 0, car, world.start, Matrix3f.IDENTITY, false);

    camNode = new MyCamera("Cam Node 2", App.rally.getCamera(), null);
    camNode.setLocalTranslation(0, 3, 7);
    camNode.lookAt(new Vector3f(0, 1.2f, 0), new Vector3f(0, 1, 0));

    Container myWindow = new Container();
    App.rally.getGuiNode().attachChild(myWindow);
    myWindow.setLocalTranslation(300, 300, 0);

    // Add some elements to it
    myWindow.addChild(new Label("Main Menu"));
    Button startFast = myWindow.addChild(new Button("Start Fast"));
    startFast.addClickCommands(
        new Command<Button>() {
          @Override
          public void execute(Button source) {
            startFast();
            App.rally.getGuiNode().detachChild(myWindow);
          }
        });
    Button start = myWindow.addChild(new Button("Start"));
    start.addClickCommands(
        new Command<Button>() {
          @Override
          public void execute(Button source) {
            startBasic();
            App.rally.getGuiNode().detachChild(myWindow);
          }
        });
  }