示例#1
0
  @Override
  public void simpleUpdate(float tpf) {
    if (loading) {
      if (loading_frames == 0) {
        if (game.isMultiplayer() && client.allConnected() == false) {
          return;
        }
      }

      if (loading_frames == 5) {
        if (game.isMultiplayer() && client.allLoaded() == false) {
          return;
        }
      }

      loading(loading_frames);
      loading_frames++;
    } else {

      loops = 0;

      while (System.currentTimeMillis() > next_game_tick
          && loops < MAX_FRAMESKIP
          && (game.isMultiplayer() == false || client.canContinue())) {

        if (game.isMultiplayer()) {
          client.update();
        }

        Timer.update(GAME_TPF);
        game.update(GAME_TPF);

        next_game_tick += SKIP_TICKS;
        loops++;
      }

      camera.update(tpf);
      listener.setLocation(cam.getLocation());
      listener.setRotation(cam.getRotation());
      gui.update(tpf); // nur wegen Kamera auf Minimap
    }
  }
示例#2
0
  public void loading(int pos) {
    if (pos == 0) {
      camera = new RTSCamera(getCamera());
      camera.registerWithInput(inputManager);

      loadingScreen.setProgress(0.1f, "Making Light");
    } else if (pos == 1) {

      loadShadow();
      loadLight();

      loadingScreen.setProgress(0.2f, "Loading Terrain");

    } else if (pos == 2) {
      reflectNode = new Node("reflect");
      rootNode.attachChild(reflectNode);
      nonreflectNode = new Node("non reflect");
      rootNode.attachChild(nonreflectNode);

      clickableNode = new Node("clickable");
      reflectNode.attachChild(clickableNode);
      //  clickableNode.attachChild(createTerrain());
      loadTerrain();
      loadWater();

      camera.addTerrain(terrain);
      camera.addWater(water);

      loadingScreen.setProgress(0.6f, "Loading Doodads");
    } else if (pos == 3) {
      loadDoodads();
      loadingScreen.setProgress(0.8f, "Init Game");
    } else if (pos == 4) {

      game.init();

      // gui=new GUI(game);

      game.getMyGame().init(game);

      if (game.isMultiplayer()) {
        client.finishedLoading();
      }

      loadingScreen.setProgress(1f, "Finished Loading");
    } else if (pos == 5) {
      loadingScreen.clear();
      camera.enable();

      gui = new GUI(game);
      gui.init();

      playerInput = new PlayerInput(game);
      // important input after nifty

      next_game_tick = System.currentTimeMillis();

      Timer.init();
      loading = false;
    }
  }