Documentation
¶
Overview ¶
Package visual implements the graphical interface for Spy Cards Online.
Index ¶
- Variables
- func Loop(ctx context.Context, looper Looper) (*router.PageInfo, error)
- type Card
- type CheapCardSheet
- type DeckBuilder
- type DeckPicker
- type InlineLayout
- type Layout
- type Looper
- 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) MakeScreenReaderUI() *screenreader.UI
- 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)
- func (v *Visual) Update(ctx context.Context, frameAdvance bool) (*router.PageInfo, 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 ¶
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 ¶
type CheapCardSheet struct {
// contains filtered or unexported fields
}
func NewCheapCardSheet ¶
func NewCheapCardSheet() *CheapCardSheet
func (*CheapCardSheet) Release ¶
func (s *CheapCardSheet) Release()
func (*CheapCardSheet) SetCard ¶
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 ¶
type InlineLayout struct {
*Layout
Context context.Context
Scroll *gui.Scroll
Dy float32
// contains filtered or unexported fields
}
func (*InlineLayout) Height ¶
func (l *InlineLayout) Height() float32
func (*InlineLayout) Render ¶
func (l *InlineLayout) Render(sb *sprites.Batch)
func (*InlineLayout) SetY ¶
func (l *InlineLayout) SetY(y float32)
func (*InlineLayout) Width ¶
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
ShowRelated bool
DefaultFocus bool
// contains filtered or unexported fields
}
Layout handles arranging a grid of cards on the screen.
type State ¶
type State uint64
const ( StateHome State = iota StateConnecting StateWait StateMatchmakingWait StateCharacterSelect StateDeckSelect StateReadyToStart StateNextRound StateNextRoundWait StateTurnSelect StateTurnProcess StateTurnEnd StateMatchCompleteWait StateMatchComplete StatePlaybackFetch StatePlaybackInit StatePlaybackIdle StatePlaybackNext StatePlaybackTurnWait StateSelectMode StateDeckEditor )
Constants for State.
type Visual ¶
func (*Visual) InitCardEditor ¶
func (*Visual) MakeScreenReaderUI ¶ added in v0.3.19
func (v *Visual) MakeScreenReaderUI() *screenreader.UI
Click to show internal directories.
Click to hide internal directories.