Created
August 14, 2012 12:41
-
-
Save panmari/3349009 to your computer and use it in GitHub Desktop.
Touch is not automatically enabled, when a TouchListener is added
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ch.aplu.cardex12; | |
import android.graphics.Color; | |
import ch.aplu.jcardgame.*; | |
import ch.aplu.android.*; | |
public class CardEx12 extends CardGame | |
{ | |
public enum Suit { | |
KREUZ, HERZ, KARO, PIK | |
} | |
public enum Rank { | |
ASS, KOENIG, DAME, BAUER, ZEHN, NEUN, ACHT, SIEBEN, SECHS | |
} | |
private Deck deck; | |
private Hand talon; | |
private Hand pile; | |
public CardEx12() | |
{ | |
super(Color.rgb(20, 80, 0), Color.WHITE, BoardType.HORZ_SPLIT, | |
windowZoom(600)); | |
} | |
public void main() | |
{ | |
deck = new Deck(Suit.values(), Rank.values(), "cover"); | |
talon = deck.dealingOut(1, 9)[0]; | |
StackLayout talonLayout = new StackLayout(new Location(200, 300)); | |
talon.setView(this, talonLayout); | |
talon.draw(); | |
pile = new Hand(deck); | |
StackLayout pileLayout = new StackLayout(new Location(400, 300)); | |
pile.setView(this, pileLayout); | |
pile.draw(); | |
talon.addCardListener(new CardAdapter() { | |
public void pressed(Card card) { | |
card.transferNonBlocking(pile); } | |
}); | |
talon.setTouchEnabled(true); // why do I need to enable it first? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment