GameView.java 文件源码

java
阅读 43 收藏 0 点赞 0 评论 0

项目:buildAPKsSamples 作者:
/**
 * The colorIndex is used to create the color based on the lower three
 * bits of the value in the current implementation.
 *
 * @param colorIndex
 */
public Ship(int colorIndex) {
    mPaint = new Paint();
    mPaint.setStyle(Style.FILL);

    setPosition(getWidth() * 0.5f, getHeight() * 0.5f);
    setVelocity(0, 0);
    setSize(mShipSize);

    mPath = new Path();
    mPath.moveTo(0, 0);
    mPath.lineTo((float) Math.cos(-CORNER_ANGLE) * mSize,
            (float) Math.sin(-CORNER_ANGLE) * mSize);
    mPath.lineTo(mSize, 0);
    mPath.lineTo((float) Math.cos(CORNER_ANGLE) * mSize,
            (float) Math.sin(CORNER_ANGLE) * mSize);
    mPath.lineTo(0, 0);

    mR = (colorIndex & 0x01) == 0 ? 63 : 255;
    mG = (colorIndex & 0x02) == 0 ? 63 : 255;
    mB = (colorIndex & 0x04) == 0 ? 63 : 255;

    mColor = colorIndex;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号