Documentation ¶
Overview ¶
Package fighters is a prototype of The Everlasting Fighters.
Index ¶
- Constants
- Variables
- type Character
- type CharacterState
- type Game
- type InputBuf
- func (b *InputBuf) Append(prev *InputFrame, ictx *input.Context)
- func (b *InputBuf) AppendFrame(prev, frame InputFrame)
- func (b *InputBuf) Decode(frames *InputFrames) error
- func (b *InputBuf) MarshalBinary() ([]byte, error)
- func (b *InputBuf) Skip(frames uint64) *InputBuf
- func (b *InputBuf) UnmarshalBinary(buf []byte) error
- type InputFrame
- type InputFrames
- type MatchState
- type PlayerState
- type State
Constants ¶
View Source
const MaxSoundFrames = 120
Variables ¶
Network code testing variables.
Functions ¶
This section is empty.
Types ¶
type Character ¶
type Character struct { Sprites []*sprites.Sprite States []CharacterState }
func (*Character) Render ¶
func (c *Character) Render(ps *PlayerState, b *sprites.Batch, sx float32)
func (*Character) Update ¶
func (c *Character) Update(s *State, ps *PlayerState, inputs InputFrame)
type CharacterState ¶
type CharacterState struct { Sprite int Sound *audio.Sound Update func(s *State, ps *PlayerState, inputs InputFrame) }
type InputBuf ¶
type InputBuf struct { StartFrame uint64 Length uint64 FrameAdv int64 Packed []byte Bits uint8 // number of bits remaining in final byte of packed buffer }
func (*InputBuf) AppendFrame ¶
func (b *InputBuf) AppendFrame(prev, frame InputFrame)
func (*InputBuf) Decode ¶
func (b *InputBuf) Decode(frames *InputFrames) error
func (*InputBuf) MarshalBinary ¶
func (*InputBuf) UnmarshalBinary ¶
type InputFrame ¶
type InputFrame [input.NumButtons]bool
InputFrame is an array of held buttons for a frame.
type InputFrames ¶
type InputFrames []InputFrame
InputFrames is a slice of InputFrame. The index in the slice corresponds to the frame number.
func (InputFrames) Predict ¶
func (f InputFrames) Predict(num uint64) InputFrame
Predict returns the predicted input for a specified frame number. If the frame is known, the actual input is returned. Otherwise, the last known input is returned.
type MatchState ¶
type MatchState int
const ( StateMatchmakingWait MatchState = iota StateMatchmakingConnecting StateMatchReady StateConnectionFailed )
type PlayerState ¶
type PlayerState struct { Char *Character Pos [2]float32 Vel [2]float32 Flip bool State int Count int Sound [MaxSoundFrames]*audio.Sound }
func (*PlayerState) SetState ¶
func (ps *PlayerState) SetState(i int)
Click to show internal directories.
Click to hide internal directories.