emulator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

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

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

func DrawCenteredText(dst draw.Image, text string, dx, dy int, c color.Color)

func DrawCharacter

func DrawCharacter(dst draw.Image, x, y int, ch byte, c color.Color)

func DrawText

func DrawText(dst draw.Image, x, y int, text string, c color.Color)

func GetSavePath

func GetSavePath(roomID string) string

Public call to get savePath

func WordWrap

func WordWrap(text string, maxLength int) []string

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

func (d *Director) GetHashPath() string

GetHashPath return the full path to hash file

func (*Director) LoadGame

func (d *Director) LoadGame() error

LoadGame creates load events and doing extra step for load

func (*Director) PlayGame

func (d *Director) PlayGame(path string)

PalyGame starts a game given a rom path

func (*Director) Run

func (d *Director) Run()

Run ...

func (*Director) SaveGame

func (d *Director) SaveGame(saveExtraFunc func() error) error

SaveGame creates save events and doing extra step for load

func (*Director) SetView

func (d *Director) SetView(view *GameView)

SetView ...

func (*Director) Start

func (d *Director) Start(paths []string)

Start ...

func (*Director) Step

func (d *Director) Step()

Step ...

type GameView

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

func NewGameView

func NewGameView(console *nes.Console, title, saveFile string, imageChannel chan<- *image.RGBA, audioChannel chan<- float32, inputChannel <-chan int) *GameView

func (*GameView) Enter

func (view *GameView) Enter()

Enter enter the game view.

func (*GameView) Exit

func (view *GameView) Exit()

Exit ...

func (*GameView) ListenToInputChannel

func (view *GameView) ListenToInputChannel()

ListenToInputChannel listen from input channel streamm, which is exposed to WebRTC session

func (*GameView) Load

func (view *GameView) Load(path string)

func (*GameView) Save

func (view *GameView) Save(hash string, extraSaveFunc func() error)

func (*GameView) Update

func (view *GameView) Update(t, dt float64)

Update is called for every period of time, dt is the elapsed time from the last frame

func (*GameView) UpdateEvents

func (view *GameView) UpdateEvents()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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