A card game engine for TCGs, primarily Magic: The Gathering but with support for others
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding draw calls for each different area, need to add text for debug purposes

authored by

Cass Unterholzner and committed by
Tangled
f1d8b1d3 3ac1f693

+37 -3
+26 -1
game/game.go
··· 31 31 return nil 32 32 } 33 33 34 + var ( 35 + area_labels = []string{ 36 + "Command", 37 + "Exile", 38 + "Graveyard", 39 + "Library", 40 + "Hand", 41 + "Resource Pool / Status Counters", 42 + "Battlefield (Lands)", 43 + "Battlefield (Non-Lands)", 44 + "Life / Commander Damage", 45 + "Player Name / Icon", 46 + } 47 + ) 48 + 34 49 func (g *Game) Draw(screen *ebiten.Image) { 35 50 op := &ebiten.DrawTrianglesOptions{} 36 51 op.Address = ebiten.AddressUnsafe 37 - DrawRect(200, 200, 500, 500, whiteImage.SubImage(image.Rect(1, 1, 2, 2)).(*ebiten.Image), screen, op) 52 + rectImage := whiteImage.SubImage(image.Rect(1, 1, 2, 2)).(*ebiten.Image) 53 + DrawRect(1770, 860, 150, 220, rectImage, screen, op, &area_labels[0]) // Command 54 + DrawRect(1620, 860, 150, 220, rectImage, screen, op, &area_labels[1]) // Exile 55 + DrawRect(1470, 860, 150, 220, rectImage, screen, op, &area_labels[2]) // Graveyard 56 + DrawRect(1320, 860, 150, 220, rectImage, screen, op, &area_labels[3]) // Library 57 + DrawRect(200, 860, 1120, 220, rectImage, screen, op, &area_labels[4]) // Hand 58 + DrawRect(0, 860, 200, 220, rectImage, screen, op, &area_labels[5]) // Resource Pool / Status Counters 59 + DrawRect(200, 0, 1720, 430, rectImage, screen, op, &area_labels[6]) // Battlefield (Lands) 60 + DrawRect(200, 430, 1720, 430, rectImage, screen, op, &area_labels[7]) // Battlefield (Non-Lands) 61 + DrawRect(0, 430, 200, 430, rectImage, screen, op, &area_labels[8]) // Life / Commander Damage 62 + DrawRect(0, 0, 200, 430, rectImage, screen, op, &area_labels[9]) // Player Name / Icon 38 63 } 39 64 40 65 func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
+11 -2
game/utils.go
··· 1 1 package game 2 2 3 - import "github.com/hajimehoshi/ebiten/v2" 3 + import ( 4 + "fmt" 5 + 6 + "github.com/hajimehoshi/ebiten/v2" 7 + ) 4 8 5 9 var ( 6 10 indices = []uint16{ ··· 9 13 } 10 14 ) 11 15 12 - func DrawRect(x, y, w, h int, image *ebiten.Image, screen *ebiten.Image, op *ebiten.DrawTrianglesOptions) { 16 + func DrawRect(x, y, w, h int, image *ebiten.Image, screen *ebiten.Image, op *ebiten.DrawTrianglesOptions, text *string) { 13 17 vertices := []ebiten.Vertex{ 14 18 { 15 19 DstX: float32(x), ··· 46 50 } 47 51 48 52 screen.DrawTriangles(vertices, indices, image, op) 53 + 54 + if text != nil { 55 + // draw text 56 + fmt.Printf("Drawing %s\n", *text) 57 + } 49 58 }