示例#1
0
  public Sprite(TileSack sack, int... frameIds) {
    mIsKilled = false;
    mSack = sack;
    mFrameIds = frameIds;
    mFrameCount = mFrameIds.length;
    mCurrentFrame = 0;

    if (sDensity < 0) {
      DisplayMetrics metrics = AirJag.getInstance().getResources().getDisplayMetrics();
      sDensity = (int) metrics.density;
    }

    if (frameIds.length > 0) {
      mWidth = sack.getWidth(frameIds[0]);
      mHeight = sack.getHeight(frameIds[0]);
    }
  }
示例#2
0
 public void render(Canvas canvas) {
   Bitmap bmp = mSack.getTile(mFrameIds[mCurrentFrame]);
   if (bmp != null) canvas.drawBitmap(bmp, scale(mX), scale(mY), null);
 }