Package org.gbcpainter.geom

Examples of org.gbcpainter.geom.PERPENDICULAR_DIRECTION


    this.addKeyListener( new KeyAdapter() {

      @Override
      public void keyPressed( final KeyEvent e ) {

        PERPENDICULAR_DIRECTION direction = getDirection( e.getKeyCode() );
        synchronized (GameHolder.this) {
          if ( direction != null && GameHolder.this.manager != null ) {
            GameHolder.this.manager.setDirectionSelected( direction, true );
          }
        }
      }

      @Override
      public void keyReleased( final KeyEvent e ) {
        PERPENDICULAR_DIRECTION direction = getDirection( e.getKeyCode() );
        synchronized (GameHolder.this) {
          if ( e.getKeyCode() == GameSettings.getInstance()
                                             .getValue( GameSettings.INTEGER_SETTINGS_TYPE.KEY_PAUSE ) ) {
            if ( GameHolder.this.manager != null ) {
              GameHolder.this.manager.pause( true );
View Full Code Here


          if ( actualPlayerPosition.equals( monsterPosition ) ) {
            deadMan = true;
          }
          final PathAnimation mobAnimation;

          @Nullable
          PERPENDICULAR_DIRECTION monsterDirection;
          if this.firstStep ) {
            monsterDirection = null;
          } else {
            monsterDirection = mob.getActualDirection();
View Full Code Here

  }

  @NotNull
  @Override
  public PERPENDICULAR_DIRECTION getNewDirection( @Nullable final PERPENDICULAR_DIRECTION previousDirection, final boolean shouldReset ) {
    final PERPENDICULAR_DIRECTION exclude;
    if ( shouldReset ) {
      exclude = previousDirection;
    } else if ( previousDirection != null ) {
      exclude = previousDirection.getOpposite();
    } else {
      exclude = null;
    }

    synchronized (this) {
      final PERPENDICULAR_DIRECTION direction = utilGetFilteredDirection( exclude );
      setDirection( direction );
      return direction;
    }
  }
View Full Code Here

  @NotNull
  @Override
  public PERPENDICULAR_DIRECTION getNewDirection( @Nullable final PERPENDICULAR_DIRECTION previousDirection, final boolean shouldReset ) {

    final PERPENDICULAR_DIRECTION exclude;
    if ( shouldReset ) {
      exclude = previousDirection;
    } else if ( previousDirection != null ) {
      exclude = previousDirection.getOpposite();
    } else {
      exclude = null;
    }

    synchronized (this) {
      final PERPENDICULAR_DIRECTION direction = this.utilGetFilteredDirection( exclude );
      this.setDirection( direction );
      return direction;
    }
  }
View Full Code Here

  }

  @NotNull
  @Override
  public PERPENDICULAR_DIRECTION getNewDirection( @Nullable final PERPENDICULAR_DIRECTION previousDirection, final boolean shouldReset ) {
    final PERPENDICULAR_DIRECTION exclude;
    if ( shouldReset ) {
      exclude = previousDirection;
    } else if ( previousDirection != null ) {
      exclude = previousDirection.getOpposite();
    } else {
      exclude = null;
    }

    synchronized (this) {
      final PERPENDICULAR_DIRECTION direction = utilGetFilteredDirection( exclude );
      setDirection( direction );
      return direction;
    }
  }
View Full Code Here

  @Override
  protected synchronized String getResourceName() {
    EntityMovementAnimation animation = this.getAnimation();
    boolean changedDirection;
    PERPENDICULAR_DIRECTION newDirection;
    final PERPENDICULAR_DIRECTION previousDirection = this.getSlot();
    if ( animation == null || animation.isTerminated() ) {
      newDirection = this.getActualDirection();
      changedDirection = true;

    } else {
View Full Code Here

      else return the walked part
     */
    for (Map.Entry<ImmutableSegment2D, PERPENDICULAR_DIRECTION> part : this.segmentsList.entrySet()) {

      final Segment actualSegment = part.getKey();
      final PERPENDICULAR_DIRECTION direction = part.getValue();

      if ( actualSegment.equals( originalSegment ) ) {
        /*
          direction segment is a segment that may be longer than the parameter segment,
          see walkSegment for details.
View Full Code Here

    Segment resultPart = null;
    //Iterate the path and return the path segment the cursor is over
    for (Map.Entry<ImmutableSegment2D, PERPENDICULAR_DIRECTION> part : this.segmentsList.entrySet()) {

      final Segment actualSegment = part.getKey();
      final PERPENDICULAR_DIRECTION direction = part.getValue();
      resultPart = actualSegment;

      movementLength -= getLength( actualSegment, direction );
      if ( movementLength <= 0.0 ) {
        //The cursor is over the actualSegment
View Full Code Here

    Point2D resultPoint = null;
    //Iterate over the path and return the actual position
    for (Map.Entry<ImmutableSegment2D, PERPENDICULAR_DIRECTION> part : this.segmentsList.entrySet()) {

      final Segment actualSegment = part.getKey();
      final PERPENDICULAR_DIRECTION direction = part.getValue();

      movementLength -= getLength( actualSegment, direction );

      if ( movementLength <= 0.0 ) {
        //restore previous state
View Full Code Here

     */
    while ( iterator.hasNext() ) {
      final Map.Entry<ImmutableSegment2D, PERPENDICULAR_DIRECTION> part = iterator.next();

      final Segment actualSegment = part.getKey();
      final PERPENDICULAR_DIRECTION direction = part.getValue();

      if ( contains( actualSegment.getLine2D(), anyPathPoint ) ) {
        if ( ! isVertex( actualSegment.getLine2D(), anyPathPoint ) ) {
          return getPercentageOfNonStartPoint( actualSegment, direction, movementLength, anyPathPoint );
        } else {
          final double beforeLineChange = Math.min( getPercentageOfNonStartPoint( actualSegment, direction, movementLength, anyPathPoint ), 0.5 );
          if ( beforeLineChange == 0.5 ) {
            movementLength -= getLength( actualSegment, direction );
            if ( iterator.hasNext() ) {
              final Map.Entry<ImmutableSegment2D, PERPENDICULAR_DIRECTION> nextEntry = iterator.next();

              final Segment nextSegment = nextEntry.getKey();
              final PERPENDICULAR_DIRECTION nextSegmentDirection = nextEntry.getValue();

              final double afterLineChange = getPercentageOfStartPoint( nextSegment, nextSegmentDirection, movementLength, anyPathPoint );
              return afterLineChange + beforeLineChange;
            } else {
              //It is the end of the path
View Full Code Here

TOP

Related Classes of org.gbcpainter.geom.PERPENDICULAR_DIRECTION

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.