コード例 #1
0
 @Override
 public boolean pan(float x, float y, float deltaX, float deltaY) {
   if (!this.disableDrag) {
     region_of_interest_.Pan(deltaX, deltaY);
   }
   return true;
 }
コード例 #2
0
 @Override
 public boolean scrolled(int amount) {
   if (this.disableDrag) {
     return false;
   }
   Vector3 mouse_pos = this.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
   return region_of_interest_.Zoom(mouse_pos.x, mouse_pos.y, amount * 25);
 }
コード例 #3
0
 @Override
 public boolean zoom(Vector2 screenLocus, float amount) {
   if (this.disableDrag) {
     return false;
   }
   Vector3 locus = this.unproject(new Vector3(screenLocus.x, screenLocus.y, 0));
   return region_of_interest_.Zoom(locus.x, locus.y, amount * 0.5f);
 }
コード例 #4
0
  @Override
  public void render(float delta) {
    super.render(delta);

    int nextNodeIndex = -1;

    // prepare text

    kApplication.spriteBatch().begin();
    {
      this.background.draw(kApplication.spriteBatch());
    }
    kApplication.spriteBatch().end();

    this.chessboard_renderer_.begin();
    {
      nextNodeIndex = game_path_.peek().render(region_of_interest_);
    }
    this.chessboard_renderer_.end();

    kApplication.spriteBatch().begin();
    {
      hud.render(kApplication.spriteBatch(), delta);
    }
    kApplication.spriteBatch().end();

    if (nextNodeIndex > -1) {
      if (game_path_.size() > 1) {

        // Cull grandchildren to deallocate memory
        GraphSquare cur_top = game_path_.pop();
        game_path_.peek().CullGrandChildrenExcept(cur_top);
        game_path_.push(cur_top);
      }
      this.region_of_interest_.Reconstrain(
          game_path_.peek().getChildVirtualPosition(nextNodeIndex));
      game_path_.push(game_path_.peek().getChildNode(nextNodeIndex));

      this.hud.pushMove(this.game_path_.peek().toString());

    } else if (game_path_.size() > 1 && this.region_of_interest_.ZoomOutRequired()) {
      GraphSquare previous = game_path_.pop();
      region_of_interest_.Deconstrain(
          game_path_.peek().getChildVirtualPosition(game_path_.peek().getChildIndex(previous)));
      this.hud.popMove();
    }
  }