Documentation ¶
Overview ¶
Package visual implements the graphical interface for Spy Cards Online.
Index ¶
- Variables
- func Loop(ctx context.Context, looper interface{ ... }) error
- type Card
- type CheapCardSheet
- type DeckBuilder
- type DeckPicker
- type InlineLayout
- type Layout
- type State
- type Visual
- func (v *Visual) InitCardEditor(ctx context.Context, codes string) error
- func (v *Visual) JoinMatch(ctx context.Context, code string) error
- func (v *Visual) Render(ctx context.Context) error
- func (v *Visual) Resize(ctx context.Context) error
- func (v *Visual) SetDeck(ctx context.Context, code string) error
- func (v *Visual) SetRecording(ctx context.Context, code string) error
- func (v *Visual) Update(ctx context.Context, frameAdvance bool) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AsNPC causes an NPC to play the game instead of the user. AsNPC string // VersusNPC forces the game into singleplayer mode. VersusNPC string )
Functions ¶
func Loop ¶ added in v0.2.78
func Loop(ctx context.Context, looper interface { Resize(context.Context) error Update(context.Context, bool) error Render(context.Context) error }) error
Loop handles the graphical loop, running Update every 1/60th of a second, and Render every graphical frame. If the loop gets too backlogged, it will drop frames rather than building up pending frames infinitely.
Resize is called once at the start, then once every time the screen resolution changes.
Types ¶
type Card ¶
type Card struct { *match.Card Active *match.ActiveCard ModTP card.Number // contains filtered or unexported fields }
func (*Card) Flip ¶
func (c *Card) Flip()
Flip flips the card from face-up to face-down or vice versa.
type CheapCardSheet ¶ added in v0.3.5
type CheapCardSheet struct {
// contains filtered or unexported fields
}
func NewCheapCardSheet ¶ added in v0.3.5
func NewCheapCardSheet() *CheapCardSheet
func (*CheapCardSheet) Ready ¶ added in v0.3.5
func (s *CheapCardSheet) Ready(ctx context.Context) bool
func (*CheapCardSheet) Release ¶ added in v0.3.5
func (s *CheapCardSheet) Release()
func (*CheapCardSheet) SetCard ¶ added in v0.3.5
func (s *CheapCardSheet) SetCard(i int, c *Card)
type DeckBuilder ¶
type DeckBuilder struct { IsEditor *Visual Confirmed bool // contains filtered or unexported fields }
DeckBuilder constructs or edits a deck.
func NewDeckBuilder ¶
func NewDeckBuilder(ctx context.Context, set *card.Set) *DeckBuilder
NewDeckBuilder creates a deck builder.
func (*DeckBuilder) Render ¶
func (d *DeckBuilder) Render(ctx context.Context)
Render draws the deck builder to the screen.
func (*DeckBuilder) Update ¶
func (d *DeckBuilder) Update(ctx context.Context)
Update processes one frame of input.
type DeckPicker ¶
type DeckPicker struct { AllowCreate bool IsEditor *Visual Selected card.Deck // contains filtered or unexported fields }
func NewDeckPicker ¶
func NewDeckPicker(ctx context.Context, set *card.Set) *DeckPicker
func (*DeckPicker) Populate ¶
func (d *DeckPicker) Populate()
func (*DeckPicker) Render ¶
func (d *DeckPicker) Render(ctx context.Context)
func (*DeckPicker) Update ¶
func (d *DeckPicker) Update(ctx context.Context)
type InlineLayout ¶ added in v0.3.4
type InlineLayout struct { *Layout Context context.Context Dy float32 // contains filtered or unexported fields }
func (*InlineLayout) Height ¶ added in v0.3.4
func (l *InlineLayout) Height() float32
func (*InlineLayout) Render ¶ added in v0.3.4
func (l *InlineLayout) Render(sb *sprites.Batch)
func (*InlineLayout) SetY ¶ added in v0.3.4
func (l *InlineLayout) SetY(y float32)
func (*InlineLayout) Update ¶ added in v0.3.4
func (l *InlineLayout) Update(cam *gfx.Camera, ictx *input.Context)
func (*InlineLayout) Width ¶ added in v0.3.4
func (l *InlineLayout) Width() float32
type Layout ¶
type Layout struct { Cards []*Card MinPerRow int MaxPerRow int OnSelect func(*Card) gui.FocusHandler MinScale float32 BaseScale float32 MaxScale float32 HoverScale float32 MarginTop float32 MarginLeft float32 MarginBottom float32 MarginRight float32 PaddingX float32 PaddingY float32 ScrollPadding float32 GrowDx, GrowDy float32 CenterLastRow bool AllowScroll bool Reverse bool PinCorner uint8 Slide bool SquishY bool // contains filtered or unexported fields }
Layout handles arranging a grid of cards on the screen.
type State ¶ added in v0.3.1
type State uint64
const ( StateHome State = iota StateConnecting StateWait StateMatchmakingWait StateCharacterSelect StateDeckSelect StateReadyToStart StateNextRound StateNextRoundWait StateTurnSelect StateTurnProcess StateTurnEnd StateMatchCompleteWait StateMatchComplete StatePlaybackInit StatePlaybackIdle StatePlaybackNext StatePlaybackTurnWait StateSelectMode StateSettings StateSpoilerGuard StateDeckEditor )
Constants for State.
Click to show internal directories.
Click to hide internal directories.