課程
/移動開發(fā)
/Android
/Android-五子連珠
為何我的只有白子顯示~~
2016-06-05
源自:Android-五子連珠 2-5
正在回答
for(int i = 0,n =mWhiteArray.size(); i < n; i++ ){ ? ?Point whitePoint = mWhiteArray.get(i); ? ?canvas.drawBitmap(mWhitePiece, ? ? ? ? ? ?(whitePoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight, ? ? ? ? ? ?(whitePoint.y + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,null);}for(int i = 0,n =mBlackArray.size(); i < n; i++ ){ ? ?Point blackPoint = mBlackArray.get(i); ? ?canvas.drawBitmap(mBlackPiece, ? ? ? ? ? ?(blackPoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight, ? ? ? ? ? ?(blackPoint.y + (1 - r的atioPieceOfLineHeight) / 2) * mLineHeight,null);
上面大神說的如果試了不行的話看看?canvas.drawBitmap(mBlackPiece,? ? ? ? ? ?(blackPoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,? ? ? ? ? ?(blackPoint.y + (1 - r的atioPieceOfLineHeight) / 2) * mLineHeight,null);
那個mBlackPiece是不是沒改
是不是在
@Overrideprotected void onSizeChanged(int w, int h, int oldw, int oldh) { ? ?super.onSizeChanged(w, h, oldw, oldh); ? ?mPanelWidth = w; ? ?mLineHeight = mPanelWidth * 1.0f / MAX_LINE; ? ?int pieceWidth = (int) (mLineHeight * ratioPieceOfLineHeight); ? ?mWhitePiece = Bitmap.createScaledBitmap(mWhitePiece, pieceWidth, pieceWidth, false); ? ?mBlackPiece = Bitmap.createScaledBitmap(mBlackPiece, pieceWidth, pieceWidth, false);}
?中的:mBlackPiece = Bitmap.createScaledBitmap(mBlackPiece, pieceWidth, pieceWidth, false);
沒把mWhitePiece改成mBlackPiece!
我遇到樓上的問題了,有大神解答嗎
我遇到的問題也是這樣,不知樓主解決了沒????
每次下完子之后,要更改mIsWhite的值,入下所示代碼中的最后一行
//判斷當前是誰在走 if?(mIsWhite){ ????mWhiteArray.add(p); }else?{ ????mBlackArray.add(p); } invalidate(); mIsWhite?=?!mIsWhite;
舉報
Android游戲開發(fā)-五子連珠,本教程通過UI與邏輯實現(xiàn)雙人對戰(zhàn)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-09-25
for(int i = 0,n =mWhiteArray.size(); i < n; i++ ){
? ?Point whitePoint = mWhiteArray.get(i);
? ?canvas.drawBitmap(mWhitePiece,
? ? ? ? ? ?(whitePoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,
? ? ? ? ? ?(whitePoint.y + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,null);
}
for(int i = 0,n =mBlackArray.size(); i < n; i++ ){
? ?Point blackPoint = mBlackArray.get(i);
? ?canvas.drawBitmap(mBlackPiece,
? ? ? ? ? ?(blackPoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,
? ? ? ? ? ?(blackPoint.y + (1 - r的atioPieceOfLineHeight) / 2) * mLineHeight,null);
上面大神說的如果試了不行的話看看?canvas.drawBitmap(mBlackPiece,
? ? ? ? ? ?(blackPoint.x + (1 - ratioPieceOfLineHeight) / 2) * mLineHeight,
? ? ? ? ? ?(blackPoint.y + (1 - r的atioPieceOfLineHeight) / 2) * mLineHeight,null);
那個mBlackPiece是不是沒改
2016-09-08
是不是在
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
? ?super.onSizeChanged(w, h, oldw, oldh);
? ?mPanelWidth = w;
? ?mLineHeight = mPanelWidth * 1.0f / MAX_LINE;
? ?int pieceWidth = (int) (mLineHeight * ratioPieceOfLineHeight);
? ?mWhitePiece = Bitmap.createScaledBitmap(mWhitePiece, pieceWidth, pieceWidth, false);
? ?mBlackPiece = Bitmap.createScaledBitmap(mBlackPiece, pieceWidth, pieceWidth, false);
}
?中的:mBlackPiece = Bitmap.createScaledBitmap(mBlackPiece, pieceWidth, pieceWidth, false);
沒把mWhitePiece改成mBlackPiece!
2016-06-21
我遇到樓上的問題了,有大神解答嗎
2016-06-16
我遇到的問題也是這樣,不知樓主解決了沒????
2016-06-05
每次下完子之后,要更改mIsWhite的值,入下所示代碼中的最后一行