Example #1
0
  @Override
  public void draw(float delta) {
    StateMachine.instance().getState(GlobalState.class).getEvents().tick(delta);
    effects.update(delta);

    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    AbstractStage current = StateMachine.instance().getCurrentState().getStage();
    if (current != null) {
      Gdx.input.setInputProcessor(current);
      current.draw();
    }
    SoundButton.draw();

    if (recorder != null) {
      recorder.record(30);
    }
  }
Example #2
0
  private void initState() {
    effects = new EffectsManager();
    // effects.initOtgy(1000);
    effects.initBitbreak(1000);

    menuStage = new MenuStage(effects);
    gameStage = new GameStage(effects);
    lostStage = new LostStage(effects);
    finishStage = new FinishStage(effects);
    pauseStage = new PauseStage(effects);
    seedStage = new SeedStage(effects);
    StateMachine.instance().getState(MenuState.class).setStage(menuStage);
    StateMachine.instance().getState(SeedState.class).setStage(seedStage);
    StateMachine.instance().getState(LevelState.class).setStage(gameStage);
    StateMachine.instance().getState(LevelWinningState.class).setStage(gameStage);
    StateMachine.instance().getState(LevelLosingState.class).setStage(gameStage);
    StateMachine.instance().getState(LevelPauseState.class).setStage(gameStage);
    StateMachine.instance().getState(LevelInitState.class).setStage(gameStage);
    StateMachine.instance().getState(LevelLostState.class).setStage(lostStage);
    StateMachine.instance().getState(LevelWonState.class).setStage(finishStage);
    StateMachine.instance().getState(LevelPauseState.class).setStage(pauseStage);
    GlobalState gs = StateMachine.instance().getState(GlobalState.class);
    gs.setGravitySensorEnabled(Gdx.app.getType() == ApplicationType.Android);
  }