wm

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT, Unlicense Imports: 28 Imported by: 0

Documentation

Overview

package wm implements platform specific windows and GPU contexts.

Index

Constants

This section is empty.

Variables

View Source
var ErrDeviceLost = errors.New("GPU device lost")

ErrDeviceLost is returned from Context.Present when the underlying GPU device is gone and should be recreated.

Functions

func Main

func Main()

func NewWindow

func NewWindow(window Callbacks, opts *Options) error

Types

type Callbacks

type Callbacks interface {
	SetDriver(d Driver)
	Event(e event.Event)
	// Func runs a function during an Event. This is required for platforms
	// that require coordination between the rendering goroutine and the system
	// main thread.
	Run(f func())
}

type Context

type Context interface {
	API() gpu.API
	Present() error
	MakeCurrent() error
	Refresh() error
	Release()
	Lock()
	Unlock()
}

type Driver

type Driver interface {
	// SetAnimating sets the animation flag. When the window is animating,
	// FrameEvents are delivered as fast as the display can handle them.
	SetAnimating(anim bool)

	// ShowTextInput updates the virtual keyboard state.
	ShowTextInput(show bool)

	SetInputHint(mode key.InputHint)

	NewContext() (Context, error)

	// ReadClipboard requests the clipboard content.
	ReadClipboard()
	// WriteClipboard requests a clipboard write.
	WriteClipboard(s string)

	// Option processes option changes.
	Option(opts *Options)

	// SetCursor updates the current cursor to name.
	SetCursor(name pointer.CursorName)

	// Close the window.
	Close()
	// Wakeup wakes up the event loop and sends a WakeupEvent.
	Wakeup()
}

Driver is the interface for the platform implementation of a window.

type FrameEvent

type FrameEvent struct {
	system.FrameEvent

	Sync bool
}

type Options

type Options struct {
	Size            *Size
	MinSize         *Size
	MaxSize         *Size
	Title           *string
	WindowMode      *WindowMode
	StatusColor     *color.NRGBA
	NavigationColor *color.NRGBA
	Orientation     *Orientation
	CustomRenderer  bool
}

type Orientation

type Orientation uint8
const (
	AnyOrientation Orientation = iota
	LandscapeOrientation
	PortraitOrientation
)

type Size

type Size struct {
	Width  unit.Value
	Height unit.Value
}

type ViewEvent

type ViewEvent struct{}

func (ViewEvent) ImplementsEvent

func (_ ViewEvent) ImplementsEvent()

type WakeupEvent

type WakeupEvent struct{}

func (WakeupEvent) ImplementsEvent

func (_ WakeupEvent) ImplementsEvent()

type WindowMode

type WindowMode uint8
const (
	Windowed WindowMode = iota
	Fullscreen
)

Jump to

Keyboard shortcuts

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