render

package
v0.0.0-...-51a18f4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BGR555

type BGR555 struct {
	Color       uint16
	Transparent bool
}

BGR555 represents 16-bit opaque color, each channel uses 5 bits with red in the least significant bits

func (BGR555) Add

func (c1 BGR555) Add(c2 BGR555) BGR555

Add 2 colors, channel by channel without wrapping

func (BGR555) ApplyBrightness

func (c BGR555) ApplyBrightness(bness uint8) BGR555

ApplyBrightness apply the given brightness from 0 to 15 If the brightness is 0 we return a black color otherwise we replace the colors by color * brightness + 1 / 16

func (BGR555) Halve

func (c BGR555) Halve() BGR555

func (BGR555) MarshalJSON

func (c BGR555) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (BGR555) RGBA

func (c BGR555) RGBA() (r, g, b, a uint32)

RGBA implements the color.Color interface

func (BGR555) Sub

func (c1 BGR555) Sub(c2 BGR555) BGR555

Substract 2 colors, channel by channel without wrapping

type EbitenRenderer

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

EbitenRenderer is a Renderer implementation using ebiten

func (*EbitenRenderer) Draw

func (er *EbitenRenderer) Draw(screen *ebiten.Image)

update copies the content of the offscreenBuffer to the screen

func (*EbitenRenderer) Layout

func (er *EbitenRenderer) Layout(outsideWidth, outsideHeight int) (int, int)

func (*EbitenRenderer) Render

func (er *EbitenRenderer) Render(screen *Screen)

Render updates the offscreen buffer with the new SNES screen content

func (*EbitenRenderer) Run

func (er *EbitenRenderer) Run()

Run starts the ebiten main loop should be called on the main thread

func (*EbitenRenderer) SetRomTitle

func (er *EbitenRenderer) SetRomTitle(title string)

SetRomTitle stores the new title if ebiten is not yet running or set the title directly

func (*EbitenRenderer) Stop

func (er *EbitenRenderer) Stop()

Stop implements the Renderer interface

func (*EbitenRenderer) Update

func (er *EbitenRenderer) Update() error

type ImageRenderer

type ImageRenderer struct {
	Image *image.RGBA
	// contains filtered or unexported fields
}

func NewImageRenderer

func NewImageRenderer(width, height int, path string) *ImageRenderer

func (*ImageRenderer) Render

func (i *ImageRenderer) Render(screen *Screen)

func (ImageRenderer) Run

func (i ImageRenderer) Run()

func (ImageRenderer) SetRomTitle

func (i ImageRenderer) SetRomTitle(string)

func (ImageRenderer) Stop

func (i ImageRenderer) Stop()

type NoOpRenderer

type NoOpRenderer struct{}

func (NoOpRenderer) Render

func (n NoOpRenderer) Render(*Screen)

func (NoOpRenderer) Run

func (n NoOpRenderer) Run()

func (NoOpRenderer) SetRomTitle

func (n NoOpRenderer) SetRomTitle(string)

func (NoOpRenderer) Stop

func (n NoOpRenderer) Stop()

type Pixel

type Pixel struct {
	Color    BGR555
	Visible  bool
	Priority uint8
}

Pixel represents a pixel

type Renderer

type Renderer interface {
	Render(*Screen)
	Stop()
	SetRomTitle(string)
	Run()
}

Renderer defines the interface required to render pixels

func NewRenderer

func NewRenderer(width, height int) (Renderer, error)

NewRenderer returns one of the available renderers

type Screen

type Screen struct {
	Pixels []Pixel
	Width  uint16
	Height uint16
	// contains filtered or unexported fields
}

func NewScreen

func NewScreen(width, height uint16) *Screen

func (*Screen) At

func (s *Screen) At(x, y int) color.Color

func (*Screen) Bounds

func (s *Screen) Bounds() image.Rectangle

func (*Screen) ColorModel

func (s *Screen) ColorModel() color.Model

func (*Screen) SetPixelLine

func (s *Screen) SetPixelLine(line uint16, pixels []Pixel)

Jump to

Keyboard shortcuts

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