Package com.sirenian.hellbound.domain

Examples of com.sirenian.hellbound.domain.Segment


    private Segments removeAnyFilledLines(Segments newSegments) {
        Segments results = newSegments;
        for (int y = 0; y < height; y++) {
            boolean lineFilled = true;
            for (int x = 0; x < width && lineFilled; x++) {
                if (!results.contains(new Segment(x, y))) {
                    lineFilled = false;
                }
            }
            if (lineFilled) {
                results = removeLine(results, y);
View Full Code Here


    }

    private Segments removeLine(Segments newSegments, int y) {
        Segments results = newSegments;
        for (int x = 0; x < width; x++) {
            results = results.remove(new Segment(x, y));
        }
       
        for (int j = y - 1; j >= 0; j--) {
            for (int x = 0; x < width; x++) {
                if (newSegments.contains(new Segment(x, j))) {
                    results = results.replace(new Segment(x, j), new Segment(x, j + 1));
                }
               
            }
        }
        return results;
View Full Code Here

   
    super(type, type.getSegments(0).movedRight(centre));
    this.detector = detector;
    this.type = type;
        this.rotation = 0;
        this.root = new Segment(centre, 0);
   
  }
View Full Code Here

        this.root = new Segment(centre, 0);
   
  }
 
  public boolean requestMoveDown() {
    return attemptMoveTo(segments.movedDown(), rotation, new Segment(root.x, root.y + 1));
  }
View Full Code Here

  public boolean requestMoveDown() {
    return attemptMoveTo(segments.movedDown(), rotation, new Segment(root.x, root.y + 1));
  }

    public boolean requestMoveLeft() {
        return attemptMoveTo(segments.movedLeft(), rotation, new Segment(root.x - 1, root.y));
    }
View Full Code Here

    public boolean requestMoveLeft() {
        return attemptMoveTo(segments.movedLeft(), rotation, new Segment(root.x - 1, root.y));
    }

    public boolean requestMoveRight() {
        return attemptMoveTo(segments.movedRight(), rotation, new Segment(root.x + 1, root.y));
    }
View Full Code Here

    }
 
  public void paint(Graphics g) {
    for (int i = 0; i < pitWidth; i++) {
      for (int j = 0; j < pitHeight; j++) {
        GlyphType type = (GlyphType)TYPEMAP.get(new Segment(i, j));
        if (type == null) { type = GlyphType.PIT; }
        Color color = colorMap.getColorFor(type);
        g.setColor(color);
        g.fillRect((scale * i), (scale * j), scale, scale);
      }
View Full Code Here

        ensureThat(segments, eq(GlyphType.O.getSegments(0)));
    }
   
  public void shouldNotifyListenersOfMovement() throws Exception {
     
    Segments segments1 = new Segments(new Segment[] {new Segment(0, 0)});
    Segments segments2 = new Segments(new Segment[] {new Segment(0, 1)});
   
    Glyph glyph = new Glyph(GlyphType.O, GlyphType.O.getSegments(0));
   
    Mock listener1 = mock(GlyphListener.class);
    Mock listener2 = mock(GlyphListener.class);
View Full Code Here

 

  public void shouldConfirmIfAnySegmentsOverlapWithGivenSegments() {
    Glyph glyph = new Glyph(GlyphType.O, GlyphType.O.getSegments(0));
   
    ensureThat(!glyph.overlaps(new Segments(new Segment[]{new Segment(-1, -1)})));
    ensureThat(glyph.overlaps(GlyphType.T.getSegments(0)));
  }
View Full Code Here

  private void setUp() {
    listener = new VerifiableGlyphListener();
   
    CollisionDetector detector = new StubCollisionDetector(new Segments(
        new Segment(3, 5),
        new Segment(4, 5),
        new Segment(5, 5),
        new Segment(6, 5)
    ));
   
    glyph = new LivingGlyph(
        GlyphType.O,
        detector,
View Full Code Here

TOP

Related Classes of com.sirenian.hellbound.domain.Segment

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.