ui

package
v0.0.0-...-2948066 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidJoypadCode = errors.New("Invalid joypad code")

ErrInvalidJoypadCode returned for an invalid joypad code

Functions

func Close

func Close()

Close things

func Initialize

func Initialize() error

Initialize things

Types

type ControlEvent

type ControlEvent byte

ControlEvent is a key event that is not one of the 8 gameboy key events

const ControlEventMute ControlEvent = 3

ControlEventMute signals a mute request

const ControlEventPause ControlEvent = 2

ControlEventPause signals a pause request

const ControlEventQuit ControlEvent = 0

ControlEventQuit signals a quit request

const ControlEventReset ControlEvent = 1

ControlEventReset signals a reset request

type Input

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

Input is a Keystroker implementer

func NewInput

func NewInput(mapping map[int32]config.EJoypad) *Input

NewInput creates Input instance

func (*Input) AddKeyEvent

func (i *Input) AddKeyEvent(code sdl.Keycode, pressed bool)

AddKeyEvent to queue

func (*Input) GetKeystroke

func (i *Input) GetKeystroke() *joypad.Keystroke

GetKeystroke returns a gameboy key code

func (*Input) Stop

func (i *Input) Stop()

Stop waiting for key events

func (*Input) WaitForKeyEvents

func (i *Input) WaitForKeyEvents() ControlEvent

WaitForKeyEvents blocks until a key is pressed or unpressed

type Sound

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

Sound plays samples from the apu

func (*Sound) BufferSize

func (s *Sound) BufferSize() uint16

BufferSize is the size of the samples buffer

func (*Sound) Close

func (s *Sound) Close() error

Close the sound

func (*Sound) Frequency

func (s *Sound) Frequency() int

Frequency of sound (samples/sec)

func (*Sound) Initialize

func (s *Sound) Initialize(dev int) error

Initialize the sound

func (*Sound) Mute

func (s *Sound) Mute(mute bool)

Mute or unmute the sound

func (*Sound) Queue

func (s *Sound) Queue(samples []byte) error

Queue samples to buffer

func (*Sound) SamplesCount

func (s *Sound) SamplesCount() uint32

SamplesCount return the current number of samples in buffer

type Window

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

Window represents the device's lcd screen

func NewWindow

func NewWindow(title string, scale int, color0, color1, color2, color3 uint32) (*Window, error)

NewWindow creates Window instance

func (*Window) Close

func (l *Window) Close() error

Close destroys the texture, renderer and window

func (*Window) DrawFrame

func (l *Window) DrawFrame(f *display.Frame) error

DrawFrame to window

Jump to

Keyboard shortcuts

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