/* * WEPiece - the west-east pipe piece * * by Adam Doppelt * http://www.cs.brown.edu/people/amd/ */ import java.awt.*; public class WEPiece extends Piece { static PieceType type_; static public void SetupStatics(Component c, Image image) { type_ = new PieceType(c); for (int loop = 0; loop < SLICES; ++loop) { double percent = (double)loop / (double)DIV_SLICES; double y = PIPE_WIDTH / 2 * Math.cos(2.0 * Math.PI * percent); type_.x1_[loop] = PercentPixel(percent); type_.y1_[loop] = PercentPixel(CENTER - y); type_.x2_[loop] = PercentPixel(percent); type_.y2_[loop] = PercentPixel(CENTER + y); type_.visible_[loop] = true; } type_.red_ = true; type_.green_ = true; type_.blue_ = false; type_.legalDirections_ = WEST + EAST; type_.flipDirections_ = WEST; if (image == null) type_.GenerateImage(); else type_.stamp_ = image; } public WEPiece() { super(type_); } }