delay

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: GPL-3.0, GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package delay is a replacement for the future package, which has now been removed. This package (and the package it replaces) helps emulate the latching delays of the TIA.

The future package served it's purpose during early, exploratory phases of the emulator's development. I wasn't sure at first what was needed and the future package developed as a way of supporting experimentation with the various elements of the TIA system.

The delay package is a lot simpler and consequently a lot more efficient.

The only element in the package is the Event type. An Event type instance represents a single future change to the TIA system, which will take place after the stated number of cycles.

To effectively emulate the electronics of the TIA these Events can be dropped, rescheduled or premepted almost at will.

Ordering of Events is rarely significant but in the instances where it is comments are included in the code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

Event represents an event that will occur in the future

func (*Event) AboutToEnd

func (e *Event) AboutToEnd() bool

AboutToEnd returns true if the event concludes (and the payload run) on the next call to Tikc()

func (*Event) Drop

func (e *Event) Drop()

Drop will cancel a event. Payload will not be run. Used by ball and player sprites.

func (*Event) Force

func (e *Event) Force()

Force an event to run the payload now. Cancels the future event. Used by missile and player sprites.

func (*Event) IsActive

func (e *Event) IsActive() bool

IsActive returns true if the event is "running" (is yet to drop the payload). Note that paused event will still report as being active.

func (*Event) JustStarted

func (e *Event) JustStarted() bool

JustStarted returns true if Tick() has not yet been called.

func (*Event) Pause

func (e *Event) Pause()

Pause the ticking of the event. Tick() will have no effect. There is no Resume() function because it is not needed. However, a paused event can be Forced() (missile and player sprites) or Dropped() (ball and player sprites)

func (*Event) Push

func (e *Event) Push()

Push event so that it starts again. Same as dropping and rescheduling although JustStarted() will not return true for a pushed event. Used by player, missile and ball sprites

func (*Event) Remaining

func (e *Event) Remaining() int

The number of remaining cycles

func (*Event) Schedule

func (e *Event) Schedule(delay int, payload func(interface{}), arg interface{})

Schedule an event to occur in the future. The payload function will run after delay number of cycles.

func (*Event) Tick

func (e *Event) Tick()

Tick the event forward one cycle. Should be called once per color clock from the TIA or TIA controlled subsystem (eg. the player sprite).

Jump to

Keyboard shortcuts

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