Documentation ¶
Overview ¶
credit to https://github.com/fogleman/nes
credit to https://github.com/fogleman/nes
credit to https://github.com/fogleman/nes
Index ¶
- Constants
- func DrawCenteredText(dst draw.Image, text string, dx, dy int, c color.Color)
- func DrawCharacter(dst draw.Image, x, y int, ch byte, c color.Color)
- func DrawText(dst draw.Image, x, y int, text string, c color.Color)
- func GetSavePath(roomID string) string
- func WordWrap(text string, maxLength int) []string
- type Director
- func (d *Director) GetHashPath() string
- func (d *Director) LoadGame() error
- func (d *Director) PlayGame(path string)
- func (d *Director) Run()
- func (d *Director) SaveGame(saveExtraFunc func() error) error
- func (d *Director) SetView(view *GameView)
- func (d *Director) Start(paths []string)
- func (d *Director) Step()
- type GameView
Constants ¶
View Source
const ( SampleRate = 16000 Channels = 1 TimeFrame = 60 AppAudio = 1 )
Audio consts
View Source
const NumKeys = 8
Variables ¶
This section is empty.
Functions ¶
func DrawCenteredText ¶
Types ¶
type Director ¶
type Director struct { Done chan struct{} // contains filtered or unexported fields }
Director is the nes emulator
func NewDirector ¶
func NewDirector(roomID string, imageChannel chan<- *image.RGBA, audioChannel chan<- float32, inputChannel <-chan int) *Director
NewDirector returns a new director
func (*Director) GetHashPath ¶
GetHashPath return the full path to hash file
type GameView ¶
type GameView struct {
// contains filtered or unexported fields
}
func NewGameView ¶
func (*GameView) ListenToInputChannel ¶
func (view *GameView) ListenToInputChannel()
ListenToInputChannel listen from input channel streamm, which is exposed to WebRTC session
func (*GameView) Update ¶
Update is called for every period of time, dt is the elapsed time from the last frame
func (*GameView) UpdateEvents ¶
func (view *GameView) UpdateEvents()
Click to show internal directories.
Click to hide internal directories.