The attached file is a shell for writing card games. It contains the standard 52 card faces plus a variety of card backs and Jokers, along with the code for manipulating and showing them.
Routines include the following:
ShuffleCards - mixes up the cards and "deals them" to four hands (puts them into four sorted arrays).
ShowHand - displays the user's hand at the bottom of the screen.
Card_Click - either raises the user's selected card above the rest or plays the card by moving it to the center of the table and realigning the remaining cards.
AllowSuit - when a user must play from a specific suit, the cards in the others suits are darkened and disabled.
It should be fairly easy to adjust the code for different numbers of hands, card display location, etc.
I couldn't get automatic adjustment in the code to work for different screen dimensions and densities, so three layouts are included in landscape orientation: 800x480x160, 800x480x240, and 480x320x160. If you have a device on which none of these looks right and can fix it, I would appreciate getting the layout to include. Or if you can do it all programmatically, that would be good too.
Any other general purpose card handling routines are welcomed as well. Thanks to "dlfallen" who provided the card faces and some other help, as well as others on the forum who helped.
This is public domain, so do whatever you want with it. I'm working on converting my old CardShark Hearts and CardShark Spades games, so don't do those games!!
Routines include the following:
ShuffleCards - mixes up the cards and "deals them" to four hands (puts them into four sorted arrays).
ShowHand - displays the user's hand at the bottom of the screen.
Card_Click - either raises the user's selected card above the rest or plays the card by moving it to the center of the table and realigning the remaining cards.
AllowSuit - when a user must play from a specific suit, the cards in the others suits are darkened and disabled.
It should be fairly easy to adjust the code for different numbers of hands, card display location, etc.
I couldn't get automatic adjustment in the code to work for different screen dimensions and densities, so three layouts are included in landscape orientation: 800x480x160, 800x480x240, and 480x320x160. If you have a device on which none of these looks right and can fix it, I would appreciate getting the layout to include. Or if you can do it all programmatically, that would be good too.
Any other general purpose card handling routines are welcomed as well. Thanks to "dlfallen" who provided the card faces and some other help, as well as others on the forum who helped.
This is public domain, so do whatever you want with it. I'm working on converting my old CardShark Hearts and CardShark Spades games, so don't do those games!!
Attachments
Last edited: