I am trying to build a card based game in which a card is added to player after every round. To win the match player has to remove all cards from his deck. However I have also drawn some additional button for some other purposes. The issue is that when the number of cards got high, they hide behind the buttons like below image.
Is there any way through which i can draw the bitmaps in a fixed area? Something like below image (highlighted rectangle behind the card images).
Following is my code to draw Bitmaps for one player
private void setMainPlayer() {
// Log.d(TAG, "Inside Set Main Player Method");
Card localcard = null;
Bitmap localimage = null;
int currentiteration = 0;
int Card_Gap = Screen_Width / 10;
int Down_Card_Gap = 0;
int Down_Card_Gap_positive = 0;
int Down_Card_Gap_negative = 0;
playerList.get(0).sortBySuit();
// Log.d(TAG,"Main Player Deck size"+MainPlayer.Count());
while (currentiteration < playerList.get(0).decksize()) {
localcard = playerList.get(0).getCard(currentiteration);
localcard.setCurrent_Y(Screen_Height - localcard.getImage(context, Card_Width, Card_Height).getHeight());
playerList.get(0).setCurrentCard(localcard, currentiteration);
currentiteration++;
if (Down_Card_Gap >= 0) {
Down_Card_Gap_positive = Down_Card_Gap;
localcard.setCurrent_X(Screen_Center_X + Down_Card_Gap_positive);
Down_Card_Gap += Card_Gap;
} else {
Down_Card_Gap_negative = Down_Card_Gap;
localcard.setCurrent_X(Screen_Center_X + Down_Card_Gap_negative);
}
Down_Card_Gap *= -1;
}
}
private void DrawMainPlayerDeck(Canvas canvas) {
// Log.d(TAG, " Inside Draw Main Player Deck");
Card localcard;
int currentiteration = 0;
while (currentiteration < playerList.get(0).decksize()) {
localcard = playerList.get(0).getCard(currentiteration);
canvas.drawBitmap(localcard.getImage(context, Card_Width, Card_Height), localcard.getCurrent_X(), localcard.getCurrent_Y(), null);
currentiteration++;
}
}
I am drawing bitmaps on surfaceview
.
Any suggestion (even if it involves a game engine like libGDX) would be really helpful.