drawing

package
v0.0.0-...-e7a03ad Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2016 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyCellLabelFree = iota
	EmptyCellLabelHome
	EmptyCellLabelNone
)
View Source
const (
	//TODO: Support drawing with only letters
	CapabilitySettingLetters = iota
	CapabilitySettingUnicode
	CapabilitySettingEmoji
)
View Source
const BackgroundColor = tcell.Color29
View Source
const CardHeight = 7
View Source
const CardWidth = 9
View Source
const EmojiAddon = '\uFE0F'
View Source
const EmptyCellColor = tcell.Color23
View Source
const EmptyCellSelectedColor = tcell.Color35

Variables

View Source
var SuitBackupRunes = []rune{
	'C',
	'S',
	'H',
	'D',
}
View Source
var SuitRunes = []rune{
	'\u2663',
	'\u2660',
	'\u2665',
	'\u2666',
}

Functions

func BeginDrawingLoop

func BeginDrawingLoop() chan DrawingEvent

func DrawDrawable

func DrawDrawable(d Drawable)

func DrawStack

func DrawStack(cs game.CardStack, x, y int, maxHeight int, selected int)

func RenderCard

func RenderCard(c game.Card, x, y int, compress, selected bool)

func RenderEmptyCell

func RenderEmptyCell(label EmptyCellLabel, isSelected bool, x, y int)

func SetCapabilitySetting

func SetCapabilitySetting(newCap CapabilitySetting)

func SetScreen

func SetScreen(newScreen tcell.Screen)

Types

type CapabilitySetting

type CapabilitySetting int

type Drawable

type Drawable interface {
	GetPos() (int, int)
	DrawAt(x, y int)
}

func GetStackDrawables

func GetStackDrawables(cs game.CardStack, x, y int, maxHeight int, selected int) []Drawable

type DrawableCard

type DrawableCard struct {
	Card     game.Card
	Compress bool
	Selected bool
	X, Y     int
}

func (DrawableCard) DrawAt

func (dc DrawableCard) DrawAt(x, y int)

func (DrawableCard) GetPos

func (dc DrawableCard) GetPos() (int, int)

type DrawableEmptyCell

type DrawableEmptyCell struct {
	Label    EmptyCellLabel
	Selected bool
	X, Y     int
}

func (DrawableEmptyCell) DrawAt

func (dec DrawableEmptyCell) DrawAt(x, y int)

func (DrawableEmptyCell) GetPos

func (dec DrawableEmptyCell) GetPos() (int, int)

type DrawingEvent

type DrawingEvent interface{}

type DrawingEventNewAnimator

type DrawingEventNewAnimator struct {
	Anim *MultiAnimator
}

type DrawingEventNewOverlay

type DrawingEventNewOverlay struct {
	Overlay Overlay
}

type DrawingEventSync

type DrawingEventSync struct{}

type EmptyCellLabel

type EmptyCellLabel int

type Layout

type Layout struct {
	StackPositions [8]ScreenPoint
	FreePositions  [4]ScreenPoint
	HomePositions  [4]ScreenPoint

	//TODO: make hand have a dynamic position based on what is on screen (to avoid squishing etc)
	HandPosition ScreenPoint
}

func GenLayout

func GenLayout() Layout

must have called drawing.SetScreen before calling this

func (*Layout) AnimateTables

func (l *Layout) AnimateTables(tables []*game.Table) *MultiAnimator

func (Layout) DrawTable

func (l Layout) DrawTable(t *game.Table)

func (Layout) GetAllDrawables

func (l Layout) GetAllDrawables(t *game.Table) []Drawable

type MultiAnimator

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

func (*MultiAnimator) AdvanceAnimation

func (m *MultiAnimator) AdvanceAnimation() bool

Returns true if done, false otherwise

func (*MultiAnimator) DrawFinished

func (m *MultiAnimator) DrawFinished()

func (*MultiAnimator) DrawToScreen

func (m *MultiAnimator) DrawToScreen()

func (*MultiAnimator) SetFinished

func (m *MultiAnimator) SetFinished()

type MultiOverlay

type MultiOverlay []Overlay

func (MultiOverlay) Draw

func (m MultiOverlay) Draw()

type Overlay

type Overlay interface {
	Draw()
}

type ScreenPoint

type ScreenPoint struct {
	X, Y int
}

type StatusBarOverlay

type StatusBarOverlay struct {
	Left, Middle, Right string
}

func (StatusBarOverlay) Draw

func (o StatusBarOverlay) Draw()

type YouWinOverlay

type YouWinOverlay struct{}

func (YouWinOverlay) Draw

func (o YouWinOverlay) Draw()

Jump to

Keyboard shortcuts

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