Back to

package window

v0.0.0 (278e9bc)
Latest Go to latest
Published: Jun 3, 2020 | Licenses: MIT, Unlicense | Module:


Package window implements platform specific windows and GPU contexts.



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

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

func Main

func Main()

func NewWindow

func NewWindow(window Callbacks, opts *Options) error

type Callbacks

type Callbacks interface {
	SetDriver(d Driver)
	Event(e event.Event)

type Context

type Context interface {
	Backend() (backend.Device, error)
	Present() error
	MakeCurrent() error

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)
	NewContext() (Context, error)

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

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

type FrameEvent

type FrameEvent struct {

	Sync bool

type Options

type Options struct {
	Width, Height unit.Value
	Title         string
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier