platform

package
v0.0.1-pre-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyUnknown = iota
	KeyUp
	KeyDown
	KeyLeft
	KeyRight
	KeyEsc
	KeySpace
)
View Source
const (
	KeyModNone   = 0x0000
	KeyModLshift = 0x0001
	KeyModRshift = 0x0002
	KeyModLctrl  = 0x0040
	KeyModRctrl  = 0x0080
	KeyModLalt   = 0x0100
	KeyModRalt   = 0x0200
	KeyModLgui   = 0x0400
	KeyModRgui   = 0x0400
	KeyModCaps   = 0x2000
)
View Source
const (
	KeyModAlt   = KeyModLalt | KeyModRalt
	KeyModGui   = KeyModLgui | KeyModRgui
	KeyModCtrl  = KeyModLctrl | KeyModRctrl
	KeyModShift = KeyModLshift | KeyModRshift
)
View Source
const (
	MouseButtonDown = iota
	MouseButtonUp
	MouseWheel
)
View Source
const (
	ScreenScale4x3  = 200.0 / 240.0
	ScreenScale16x9 = 200.0 / 234.0
)
View Source
const MaxVolume = mix.MAX_VOLUME

Variables

View Source
var (
	ErrFileNotFound = errors.New("file not found")
	ErrFadeMusic    = errors.New("can't fadeout music")
)
View Source
var ConfigPath string
View Source
var ScreenScale = ScreenScale4x3

Functions

func CfgRootJoin

func CfgRootJoin(p ...string) string

func Init

func Init() error

func NewId64

func NewId64() uint64

func Shutdown

func Shutdown()

Types

type AudioPlayer

type AudioPlayer interface {
	LoadMusic(name string, data []byte) error
	PlayMusic(name string, fade time.Duration, loops int) error
	FadeMusic(fade time.Duration) error
	IsPlayingMusic() bool
	IsPausedMusic() bool
	StopMusic()
	PauseMusic()
	ResumeMusic()
	VolumeMusic(vol int) int
	MusicCallback(cb func())

	LoadSound(name string, data []byte) (Sound, error)
	Sound(name string) (Sound, error)

	StopChannel(channel int)
	IsPlayingChannel(channel int) bool
	FadeChannel(channel int, fade time.Duration) error
	VolumeChannel(channel, vol int) int
	ReserveChannels(num int) int
	ChannelCallback(cb func(int))

	Shutdown()
}

func NewAudioPlayer

func NewAudioPlayer() (AudioPlayer, error)

type Event

type Event interface{}

func PollEvent

func PollEvent() Event

type KeyDownEvent

type KeyDownEvent struct {
	Rune     rune
	Key, Mod int
}

type KeyUpEvent

type KeyUpEvent struct {
	Rune     rune
	Key, Mod int
}

type MouseButtonEvent

type MouseButtonEvent struct {
	X, Y, Button, Type int
}

type MouseMotionEvent

type MouseMotionEvent struct {
	X, Y, XRel, YRel int
}

type MouseState

type MouseState struct {
	X, Y    int
	Buttons [3]bool
}

func Mouse

func Mouse() MouseState

type QuitEvent

type QuitEvent struct{}

type Renderer

type Renderer interface {
	Clear()
	Present()
	Shutdown()
	ToggleFullscreen()
	SetWindowTitle(title string)
	BackBuffer() draw.Image

	DrawRect(dest image.Rectangle, c color.Color, fill bool)

	BlitPaletted(dp image.Point, src *image.Paletted)
	BlitImage(dp image.Point, src *image.Paletted, pal color.Palette)
	Blit(dp image.Point, src *image.Paletted, sr image.Rectangle, pal color.Palette)
}

func NewRenderer

func NewRenderer(w, h int, data ...interface{}) (Renderer, error)

type Sound

type Sound interface {
	String() string
	Length() time.Duration
	Play(channel, loops int, fade time.Duration) (int, error)
	Volume(vol int) int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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