pin

package
v0.0.0-...-71fbeb2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RenderEvent = iota + 0x200
	QuitEvent
)
View Source
const (
	SwitchOff = 0x10000
)

Variables

View Source
var Load = &Loader{}
View Source
var NullHandler = nullHandler{}
View Source
var PaletteOrange = []color.RGBA{
	{0, 0, 0, 0xff},
	{15, 8, 0, 0xff},
	{33, 17, 0, 0xff},
	{51, 25, 0, 0xff},
	{66, 33, 0, 0xff},
	{84, 42, 0, 0xff},
	{102, 51, 0, 0xff},
	{117, 58, 0, 0xff},
	{135, 67, 0, 0xff},
	{153, 76, 0, 0xff},
	{168, 84, 0, 0xff},
	{186, 93, 0, 0xff},
	{204, 102, 0, 0xff},
	{219, 109, 0, 0xff},
	{237, 118, 0, 0xff},
	{255, 127, 0, 0xff},
}
View Source
var PaletteWhite = []color.RGBA{
	{0, 0, 0, 0xff},
	{15, 15, 15, 0xff},
	{33, 33, 33, 0xff},
	{51, 51, 51, 0xff},
	{66, 66, 66, 0xff},
	{84, 84, 84, 0xff},
	{102, 102, 102, 0xff},
	{117, 117, 117, 0xff},
	{135, 135, 135, 0xff},
	{153, 153, 153, 0xff},
	{168, 168, 168, 0xff},
	{186, 186, 186, 0xff},
	{204, 204, 204, 0xff},
	{219, 219, 219, 0xff},
	{237, 237, 237, 0xff},
	{255, 255, 255, 0xff},
}

Functions

func CreateSurface

func CreateSurface(width int, height int) *sdl.Surface

func DecodeDMD

func DecodeDMD(data []byte) ([]*sdl.Surface, error)

func DecodeDMD1

func DecodeDMD1(data []byte) (*sdl.Surface, error)

func NewTicker60Hz

func NewTicker60Hz() *time.Ticker

Types

type Align

type Align int
const (
	AlignLeft Align = iota
	AlignCenter
	AlignRight
)

type Blinker

type Blinker struct {
	On      bool
	Enabled bool
	Count   int
	// contains filtered or unexported fields
}

func NewBlinker

func NewBlinker(timeOn time.Duration, timeOff time.Duration) *Blinker

func (*Blinker) Start

func (b *Blinker) Start()

func (*Blinker) Update

func (b *Blinker) Update()

type Console

type Console struct {
	Keys map[Key]int
}

func (Console) ReadInput

func (c Console) ReadInput(h Handler)

type Display

type Display interface {
	Render()
}

type DisplaySDL

type DisplaySDL struct {
	Width    int
	Height   int
	Renderer *sdl.Renderer
	// contains filtered or unexported fields
}

func NewDisplaySDL

func NewDisplaySDL(mat *sdl.Surface, o OptionsSDL) (*DisplaySDL, error)

func (*DisplaySDL) Render

func (d *DisplaySDL) Render()

type FadeDir

type FadeDir int
const (
	FadeIn  FadeDir = 1
	FadeOut         = -1
)

type Fader

type Fader struct {
	X   int
	Y   int
	W   int
	H   int
	Len time.Duration
	Dir FadeDir
	// contains filtered or unexported fields
}

func NewFader

func NewFader(mat *sdl.Surface, len time.Duration, dir FadeDir) *Fader

func (*Fader) Start

func (f *Fader) Start()

func (*Fader) Update

func (f *Fader) Update()

type Font

type Font interface {
	Render(s *sdl.Surface, x int, y int, text string)
	Size(string) (int, int)
}

func LoadFontDMD

func LoadFontDMD(name string) (Font, error)

func LoadFontImage

func LoadFontImage(name string) (Font, error)

func LoadFontTTF

func LoadFontTTF(name string, size int) (Font, error)

func NewFontBitmap

func NewFontBitmap(m *sdl.Surface, tm TileMap) Font

func NewFontTTF

func NewFontTTF(font *ttf.Font, info InfoTTF) Font

type FontBitmap

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

func (*FontBitmap) Render

func (f *FontBitmap) Render(target *sdl.Surface, x int, y int, text string)

func (*FontBitmap) Size

func (f *FontBitmap) Size(text string) (int, int)

type FontTTF

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

func (*FontTTF) Render

func (f *FontTTF) Render(target *sdl.Surface, x int, y int, text string)

func (*FontTTF) Size

func (f *FontTTF) Size(text string) (int, int)

type Graphics

type Graphics struct {
	X        int
	Y        int
	MatrixH  int
	MatrixW  int
	Color    uint32
	Align    Align
	Width    int
	Height   int
	PaddingB int
	Font     Font
	// contains filtered or unexported fields
}

func NewGraphics

func NewGraphics(mat *sdl.Surface) Graphics

func (*Graphics) Copy

func (g *Graphics) Copy(src *sdl.Surface, x int, y int, w int, h int)

func (*Graphics) FillRect

func (g *Graphics) FillRect(w int, h int)

func (*Graphics) Image

func (g *Graphics) Image(image *sdl.Surface)

func (*Graphics) Print

func (g *Graphics) Print(format string, a ...interface{})

func (*Graphics) Println

func (g *Graphics) Println(text string, a ...interface{})

type Handler

type Handler interface {
	Update(int)
}

type InfoTTF

type InfoTTF struct {
	OffsetY int
}

type Input

type Input interface {
	ReadInput(Handler)
}

type Key

type Key struct {
	K   sdl.Keycode
	Mod uint16
}

type Loader

type Loader struct {
	Dir string
}

func (*Loader) FontDMD

func (l *Loader) FontDMD(name string) Font

func (*Loader) FontImage

func (l *Loader) FontImage(name string) Font

func (*Loader) FontTTF

func (l *Loader) FontTTF(name string, size int) Font

func (*Loader) Image

func (l *Loader) Image(name string) *sdl.Surface

func (*Loader) Music

func (l *Loader) Music(name string) *mix.Music

func (*Loader) Sound

func (l *Loader) Sound(name string) *mix.Chunk

type Mach

type Mach struct {
	Matrix     *sdl.Surface
	DMD        Display
	VirtualDMD Display
	Handler    Handler
	Inputs     []Input
	KeyEvents  bool
	Quit       bool
}

func NewMach

func NewMach(opts OptionsMach) (*Mach, error)

func (*Mach) Graphics

func (m *Mach) Graphics() Graphics

func (*Mach) Run

func (m *Mach) Run()

type OptionsMach

type OptionsMach struct {
	VirtualDMD bool
}

type OptionsSDL

type OptionsSDL struct {
	Scale       int
	Padding     int
	BackColor   color.RGBA
	BorderColor color.RGBA
	BorderSize  int
	Title       string
	Palette     []color.RGBA
}

func DefaultOptionsSDL

func DefaultOptionsSDL() OptionsSDL

type Slider

type Slider struct {
	Min  int
	Max  int
	Step float64
	Pos  int

	On bool
	// contains filtered or unexported fields
}

func NewSlider

func NewSlider(min int, max int, step float64) *Slider

func (*Slider) Start

func (s *Slider) Start()

func (*Slider) Update

func (s *Slider) Update()

type Tile

type Tile struct {
	X int
	Y int
	W int
	H int
}

type TileMap

type TileMap map[string]Tile

Jump to

Keyboard shortcuts

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