Documentation ¶
Index ¶
- Constants
- Variables
- type ColorIndex
- type GIF
- type Palette
- type Screen
- func (s *Screen) Close()
- func (s *Screen) Disable()
- func (s *Screen) Dump()
- func (s *Screen) Enable()
- func (s *Screen) Enabled() bool
- func (s *Screen) Palette(p []color.RGBA)
- func (s *Screen) Screenshot()
- func (s *Screen) StartRecord()
- func (s *Screen) StopRecord()
- func (s *Screen) VBlank()
- func (s *Screen) Write(colorIndex uint8)
Constants ¶
const FrameDelay = (1 / 59.7) * 100
FrameDelay is the time each GIF frame lasts, given that the Gameboy's screen is refreshed at 59.7Hz. In 100ths of a second (which is about 1.7 but we might add that up before we round it to integer). In any event, browsers seem to ignore any value of 0 or 1 (or more depending on sources) so delay will be initialized at 2 for new frames.
Variables ¶
var FrameBounds = image.Rectangle{ Min: image.Point{0, 0}, Max: image.Point{X: options.ScreenWidth, Y: options.ScreenHeight}, }
FrameBounds holds fixed bounds for each frame.
Functions ¶
This section is empty.
Types ¶
type GIF ¶
GIF recorder generating animated images on the fly.
func NewGIF ¶
NewGIF instantiates a GIF recorder that will buffer frames and then output a GIF file when required.
func (*GIF) IsOpen ¶
IsOpen returns true if GIF recording is already in progress (i.e. we have a file currently open) or false otherwise.
func (*GIF) New ¶
New starts recording a new GIF file to the provided descriptor and starts recording screen output. This should be called at VBlank time to prevent incomplete frames.
type Screen ¶
Screen represents the LCD display for a GameBoy. It works by shifting out individual pixels to a single dedicated texture.
func New ¶
New returns an SDL2 display with a greyish palette and takes a zoom factor to size the window (current default is 2x).
func (*Screen) Disable ¶
func (s *Screen) Disable()
Disable turns off the display. A disabled GB screen will be drawn at VBlank time.
func (*Screen) Dump ¶
func (s *Screen) Dump()
Dump writes the current pixel buffer to file for debugging purposes.
func (*Screen) Enable ¶
func (s *Screen) Enable()
Enable turns on the display. Pixels will be drawn to our texture and showed at VBlank time.
func (*Screen) Enabled ¶
Enabled returns whether the display is enabled or not (as part of the Display interface).
func (*Screen) Screenshot ¶
func (s *Screen) Screenshot()
Screenshot will make the display dump the next frame to file.
func (*Screen) StartRecord ¶
func (s *Screen) StartRecord()
StartRecord will create a new GIF file and output frames into it until StopRecord is called.
We only just raise a flag here, recording should start and stop in VBlank.
func (*Screen) StopRecord ¶
func (s *Screen) StopRecord()
StopRecord will flush recorded frames to the previously created GIF file. We only just raise a flag here, recording should start and stop in VBlank.