platform

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ScreenAspectRatio = float64(4) / 3

Variables

This section is empty.

Functions

func ConfigWithAudio

func ConfigWithAudio(p internalPlatform) error

func ConfigWithFullscreen

func ConfigWithFullscreen(p internalPlatform) error

func Start

func Start(mainLoop func(Platform), configs ...Config)

Types

type AudioSpec

type AudioSpec struct {
	Freq,
	Channels,
	Samples int
}

type Config

type Config func(internalPlatform) error

func ConfigWithWindowSize

func ConfigWithWindowSize(w, h int) Config

type File

type File interface {
	io.ReadWriteSeeker
	io.ReaderAt
	io.Closer
}

type FileSystem

type FileSystem interface {
	Create(name string) (File, error)
	Open(name string) (File, error)
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
}

type Platform

type Platform interface {
	FileSystem

	HasAudio() bool
	RenderGraphics(backBuffer []byte, x, y int, r, g, b byte)
	RenderText(mem []byte, blink bool, bg, cx, cy int)
	SetTitle(title string)
	QueueAudio(soundBuffer []byte)
	AudioSpec() AudioSpec
	EnableAudio(b bool)
	SetKeyboardHandler(h func(Scancode))
	SetMouseHandler(h func(byte, int8, int8))
}
var Instance Platform

type Scancode

type Scancode byte
const (
	ScanInvalid Scancode = iota
	ScanEscape
	Scan1
	Scan2
	Scan3
	Scan4
	Scan5
	Scan6
	Scan7
	Scan8
	Scan9
	Scan0
	ScanMinus
	ScanEqual
	ScanBackspace
	ScanTab
	ScanQ
	ScanW
	ScanE
	ScanR
	ScanT
	ScanY
	ScanU
	ScanI
	ScanO
	ScanP
	ScanLBracket
	ScanRBracket
	ScanEnter
	ScanControl
	ScanA
	ScanS
	ScanD
	ScanF
	ScanG
	ScanH
	ScanJ
	ScanK
	ScanL
	ScanSemicolon
	ScanQuote
	ScanBackquote
	ScanLShift
	ScanBackslash
	ScanZ
	ScanX
	ScanC
	ScanV
	ScanB
	ScanN
	ScanM
	ScanComma
	ScanPeriod
	ScanSlash
	ScanRShift
	ScanPrint
	ScanAlt
	ScanSpace
	ScanCapslock
	ScanF1
	ScanF2
	ScanF3
	ScanF4
	ScanF5
	ScanF6
	ScanF7
	ScanF8
	ScanF9
	ScanF10
	ScanNumlock
	ScanScrlock
	ScanKPHome
	ScanKPUp
	ScanKPPageup
	ScanKPMinus
	ScanKPLeft
	ScanKP5
	ScanKPRight
	ScanKPPlus
	ScanKPEnd
	ScanKPDown
	ScanKPPagedown
	ScanKPInsert
	ScanKPDelete
)
const KeyUpMask Scancode = 0x80

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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