Add tabletop components 486-500 and ten game icons
Fifteen pieces of a games night: Dice, DiceTray, PlayingCard, CardHand, Deck, Chessboard, GoBoard, MahjongTile, Domino, Roulette, CoinFlip, BingoCard, TicTacToe, ScoreTrack and Meeple. Component number 500 is a meeple, which seems right. Dice tumble, coins turn and wheels spin on a cue, a frame at a time, and land at once under Reduce Motion. Hands lift the card you point at and play the one drawn on top; pieces and stones pick the lighter of Lit and Ink for White, so they read in every palette; the computer plays a fair O; FREE is a star in every language. New 12x12 icons: Spade, Club, Diamond, Meeple, King, Queen, Rook, Bishop, Knight and Pawn.
This commit is contained in:
32 files changed
+2781
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package tabletop
|
||||
|
||||
import (
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
||||
)
|
||||
|
||||
type PlayingCardOptions struct {
|
||||
// Back shows the card face down.
|
||||
Back bool
|
||||
}
|
||||
|
||||
// PlayingCard is a card: rank and suit, or its back.
|
||||
func PlayingCard(c *ui.Context, cd Card, o PlayingCardOptions) *ui.Element {
|
||||
k := pixel.K(c)
|
||||
cd.check("PlayingCard")
|
||||
name := cd.name(k)
|
||||
if o.Back {
|
||||
name = k.Msg("card_back")
|
||||
}
|
||||
return ui.Box(c).Size(k.D(cardW), k.D(cardH)).Role(ui.RoleImage).Label(name).Draw(func(p *ui.Painter, r ui.Rect) {
|
||||
drawCard(k.Canvas(p, r), 0, 0, cd, o.Back)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user