Beispiel #1
0
  @Override
  public void render() {
    try {
      // $$$ Logger.devConsole("" + Gdx.graphics.getFramesPerSecond() + ": " +
      // Gdx.graphics.getDeltaTime());

      // Update
      Input.get().update();
      if (Input.get()
          .isActive(
              sps.bridge.Commands.get(Commands.ToggleDevConsole),
              Client.get().getFirstPlayerIndex())) {
        DevConsole.get().toggle();
      }
      if (Input.get()
          .isActive(sps.bridge.Commands.get(Commands.Back), Client.get().getFirstPlayerIndex())) {
        StateManager.loadState(new MainMenuState());
      }
      if (Input.get()
          .isActive(sps.bridge.Commands.get(Commands.Music), Client.get().getFirstPlayerIndex())) {
        MusicPlayer.get().toggle();
      }
      if (Input.get()
          .isActive(
              sps.bridge.Commands.get(Commands.ToggleFullScreen),
              Client.get().getFirstPlayerIndex())) {
        Renderer.get().toggleFullScreen();
      }

      StateManager.asyncUpdate();

      if (Client.get().nextTurn()) {
        ParticleEngine.update();
        StateManager.update();
        Client.get().prepareForNextTurn();
      } else {
        Client.get().heartBeat();
      }
      if (!IsRunning) {
        System.exit(0);
      }

      TextPool.get().update();

      // Render
      Renderer.get().begin();
      StateManager.draw();
      ParticleEngine.draw();
      HudRenderer.get().draw();
      TextPool.get().draw();
      DevConsole.get().draw();
      Renderer.get().end();
    } catch (Exception e) {
      Logger.exception(e);
    }
  }
Beispiel #2
0
 @Override
 public void create() {
   Sps.setup();
   Renderer.get().setWindowsBackground(Color.BLACK);
   Renderer.get().setStrategy(new FrameStrategy());
   Renderer.get().setRefreshInstance(this);
   Client.reset(new LocalClient());
   Input.get().setup(Client.get());
   SpriteSheetManager.setup(SpriteTypes.getDefs());
   StateManager.loadState(new MainMenuState());
   ParticleEngine.reset();
   MusicPlayer.get(new DefaultMusicPlayer());
   StateManager.loadContent();
 }
Beispiel #3
0
 @Override
 public void resize(int width, int height) {
   Renderer.get().resize(width, height);
   StateManager.resize(width, height);
 }