splendor

package module
v0.0.0-...-e0a8722 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2019 License: MIT Imports: 13 Imported by: 0

README

goSplendor

Splendor - board game.

Documentation

Index

Constants

View Source
const (
	FPS = 60

	WINDOW_WIDTH  = 1280
	WINDOW_HEIGHT = 800
)
View Source
const (
	MAX_PLAYERS = 4
)

Variables

View Source
var (
	DELTA_FPS = time.Duration(int64(time.Second) / FPS)

	BLACK      = &sdl.Color{0, 0, 0, 255}
	BLUE       = &sdl.Color{10, 10, 255, 255}
	DARK_GREEN = &sdl.Color{10, 100, 10, 255}
	GREEN      = &sdl.Color{100, 200, 100, 255}
	PURPLE     = &sdl.Color{100, 10, 100, 255}
	RED        = &sdl.Color{255, 100, 100, 255}
	SKY        = &sdl.Color{130, 130, 255, 255}
	WHITE      = &sdl.Color{255, 255, 255, 255}
	YELLOW     = &sdl.Color{255, 255, 100, 255}

	SkullColor = map[SkullType]*sdl.Color{
		SBlack: BLACK,
		SBlue:  SKY,
		SGreen: GREEN,
		SRed:   RED,
		SWhite: WHITE,
		SGold:  YELLOW,
	}

	TILE_SIZE        = 50
	TILE_BORDER_SIZE = 1
	TILE_STEP        = TILE_SIZE + TILE_BORDER_SIZE

	TILE_START_X = 153
	TILE_START_Y = 184

	LINE_WIDTH int32 = 3
)
View Source
var (
	AllSkulls = []SkullType{
		SWhite,
		SBlue,
		SGreen,
		SRed,
		SBlack,
		SGold,
	}
	AllVSkulls = AllSkulls[:len(AllSkulls)-1]
)

Functions

func Run

func Run()

Types

type Board

type Board struct {
	Skulls Skulls

	Players       []*Player
	CurrentPlayer *Player
	// contains filtered or unexported fields
}

func (*Board) CheckSkulls

func (b *Board) CheckSkulls(skulls ...SkullType) bool

func (*Board) GetSkulls

func (b *Board) GetSkulls(skulls ...SkullType)

func (*Board) Initialize

func (b *Board) Initialize()

type Button

type Button struct {
	Tile
	Text string
}

func (*Button) Draw

func (b *Button) Draw(r *sdl.Renderer)

type CardDeck

type CardDeck struct {
	// contains filtered or unexported fields
}

func (*CardDeck) Get

func (c *CardDeck) Get(i int) interface{}

func (*CardDeck) Len

func (c *CardDeck) Len() int

func (*CardDeck) Pop

func (c *CardDeck) Pop(i int) interface{}

func (*CardDeck) PopRandom

func (c *CardDeck) PopRandom() interface{}

func (*CardDeck) Put

func (c *CardDeck) Put(card interface{})

type CardTile

type CardTile struct {
	Tile

	Type SkullType
	Cost Skulls

	WP int
}

func (*CardTile) Draw

func (c *CardTile) Draw(r *sdl.Renderer)

type F

type F func()

type Font

type Font struct {
	// contains filtered or unexported fields
}

func OpenFont

func OpenFont(path string) (*Font, error)

func (*Font) Close

func (f *Font) Close()

func (*Font) Size

func (f *Font) Size(size int) *ttf.Font

type Goal

type Goal struct {
	Tile

	Cost Skulls
	WP   int
}

func (*Goal) Draw

func (g *Goal) Draw(r *sdl.Renderer)

type Layout

type Layout struct {
	sdl.Rect

	Objs []Layouter
}

func (*Layout) Add

func (l *Layout) Add(layout Layouter)

func (*Layout) Click

func (l *Layout) Click(x, y int32)

func (*Layout) Draw

func (l *Layout) Draw(r *sdl.Renderer)

func (*Layout) Inside

func (l *Layout) Inside(x, y int32) bool

func (*Layout) Move

func (l *Layout) Move(x, y int32)

type Layouter

type Layouter interface {
	Click(int32, int32)
	Move(int32, int32)
	Draw(*sdl.Renderer)
	Inside(int32, int32) bool
}

type Player

type Player struct {
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer() *Player

func (*Player) AddSkulls

func (p *Player) AddSkulls(sts []SkullType)

func (*Player) Skull

func (p *Player) Skull(st SkullType) int

type SkullToken

type SkullToken struct {
	Tile

	Type SkullType
	// contains filtered or unexported fields
}

func (*SkullToken) Draw

func (s *SkullToken) Draw(r *sdl.Renderer)

type SkullType

type SkullType int
const (
	SBlack SkullType = iota
	SBlue
	SGreen
	SRed
	SWhite
	SGold
)

type Skulls

type Skulls map[SkullType]int

func (Skulls) Clear

func (s Skulls) Clear()

func (Skulls) Count

func (s Skulls) Count() int

func (Skulls) String

func (s Skulls) String() string

func (Skulls) ToArray

func (s Skulls) ToArray() []SkullType

type TextureManager

type TextureManager struct {
	// contains filtered or unexported fields
}

func (*TextureManager) Destroy

func (t *TextureManager) Destroy()

func (*TextureManager) Get

func (t *TextureManager) Get(key string) *sdl.Texture

func (*TextureManager) Initialize

func (t *TextureManager) Initialize(r *sdl.Renderer, dirpath string) error

func (*TextureManager) Skull

func (t *TextureManager) Skull(st SkullType) *sdl.Texture

type Tile

type Tile struct {
	sdl.Rect

	Texture *sdl.Texture

	OnClick F
	OnMove  F
	// contains filtered or unexported fields
}

func (*Tile) Click

func (t *Tile) Click(x, y int32)

func (*Tile) Draw

func (t *Tile) Draw(r *sdl.Renderer)

func (*Tile) Inside

func (t *Tile) Inside(x, y int32) bool

func (*Tile) Move

func (t *Tile) Move(x, y int32)

Directories

Path Synopsis
src

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL