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,39 @@
|
||||
package tabletop_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/tabletop"
|
||||
)
|
||||
|
||||
func TestBingoCardDrawsInsideItsGrid(t *testing.T) {
|
||||
var numbers [25]int
|
||||
for i := range numbers {
|
||||
numbers[i] = i + 1
|
||||
}
|
||||
var m [25]bool
|
||||
tt := view(400, 400, newWorld(), func(c *ui.Context) { tabletop.BingoCard(c, "B", numbers, &m, tabletop.BingoCardOptions{}) })
|
||||
x, y, w, h := dots(find(t, tt, "B"))
|
||||
// The letters sit nine dots above the grid.
|
||||
if n := spill(tt.Image(), x, y-9, w, h+9); n > 0 {
|
||||
t.Fatalf("the card spills %d dots past its grid", n)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCardHandPlaysTheTopOfAnOverlap(t *testing.T) {
|
||||
cards := []tabletop.Card{{Rank: 2, Suit: tabletop.Clubs}, {Rank: 3, Suit: tabletop.Clubs}}
|
||||
played := -1
|
||||
tt := view(400, 300, newWorld(), func(c *ui.Context) {
|
||||
if i := tabletop.CardHand(c, "Hand", cards, tabletop.CardHandOptions{}).Played; i >= 0 {
|
||||
played = i
|
||||
}
|
||||
})
|
||||
r := find(t, tt, "Hand")
|
||||
// Dots 18–35 hold both cards; the second is on top.
|
||||
tt.ClickAt(r.X+2*24, r.Y+2*30)
|
||||
if played != 1 {
|
||||
t.Fatalf("a click where the cards overlap played %d", played)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user