emulator

package
v0.0.0-...-89247e0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display

type Display struct {
	Window *pixelgl.Window

	DisplayFps          bool
	DisplayInstructions bool
	// contains filtered or unexported fields
}

Display represents a display for the CHIP-8 emulator

func NewDisplay

func NewDisplay() (*Display, error)

NewDisplay creates and initializes a new Display instance

func (*Display) DisplayNotification

func (disp *Display) DisplayNotification(text string)

DisplayNotification displays the given text for a short time

func (*Display) Draw

func (disp *Display) Draw(vmem videomemory.VideoMemory)

Draw draws the content of the given VideoMemory to the window

func (*Display) ToggleFullscreen

func (disp *Display) ToggleFullscreen()

ToggleFullscreen toggles between fullscreen and windowed

func (*Display) ToggleVSync

func (disp *Display) ToggleVSync()

ToggleVSync toggles between vsync on and off

type Emulator

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

Emulator implements the CHIP-8 emulator

func NewEmulator

func NewEmulator() (*Emulator, error)

NewEmulator creates a new instance

func (*Emulator) LoadRom

func (emu *Emulator) LoadRom(rom []byte) error

LoadRom loads the given ROM into the emulator

func (*Emulator) Run

func (emu *Emulator) Run()

Run runs the main loop of the emulator

type FpsCounter

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

FpsCounter calculates the frames per second

func NewFpsCounter

func NewFpsCounter() *FpsCounter

NewFpsCounter creates and initializes a new instance

func (*FpsCounter) Tick

func (fps *FpsCounter) Tick() float64

Tick needs to be called every time a frame is drawn and returns the current fps value

Jump to

Keyboard shortcuts

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