win

package
v0.0.0-...-8d183ef Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button string

Button indicates a mouse button in an event.

const (
	ButtonLeft   Button = "left"
	ButtonRight  Button = "right"
	ButtonMiddle Button = "middle"
)

List of all mouse buttons.

type KbDown

type KbDown struct{ Key Key }

KbDown is an event that happens when a key on the keyboard gets pressed.

func (KbDown) String

func (kd KbDown) String() string

type KbRepeat

type KbRepeat struct{ Key Key }

KbRepeat is an event that happens when a key on the keyboard gets repeated.

This happens when its held down for some time.

func (KbRepeat) String

func (kr KbRepeat) String() string

type KbType

type KbType struct{ Rune rune }

KbType is an event that happens when a Unicode character gets typed on the keyboard.

func (KbType) String

func (kt KbType) String() string

type KbUp

type KbUp struct{ Key Key }

KbUp is an event that happens when a key on the keyboard gets released.

func (KbUp) String

func (ku KbUp) String() string

type Key

type Key string

Key indicates a keyboard key in an event.

const (
	KeyLeft      Key = "left"
	KeyRight     Key = "right"
	KeyUp        Key = "up"
	KeyDown      Key = "down"
	KeyEscape    Key = "escape"
	KeySpace     Key = "space"
	KeyBackspace Key = "backspace"
	KeyDelete    Key = "delete"
	KeyEnter     Key = "enter"
	KeyTab       Key = "tab"
	KeyHome      Key = "home"
	KeyEnd       Key = "end"
	KeyPageUp    Key = "pageup"
	KeyPageDown  Key = "pagedown"
	KeyShift     Key = "shift"
	KeyCtrl      Key = "ctrl"
	KeyAlt       Key = "alt"
)

List of all keyboard keys.

type MoDown

type MoDown struct {
	image.Point
	Button Button
}

MoDown is an event that happens when a mouse button gets pressed.

func (MoDown) String

func (md MoDown) String() string

type MoMove

type MoMove struct{ image.Point }

MoMove is an event that happens when the mouse gets moved across the window.

func (MoMove) String

func (mm MoMove) String() string

type MoScroll

type MoScroll struct{ image.Point }

MoScroll is an event that happens on scrolling the mouse.

The Point field tells the amount scrolled in each direction.

func (MoScroll) String

func (ms MoScroll) String() string

type MoUp

type MoUp struct {
	image.Point
	Button Button
}

MoUp is an event that happens when a mouse button gets released.

func (MoUp) String

func (mu MoUp) String() string

type Option

type Option func(*options)

Option is a functional option to the window constructor New.

func Borderless

func Borderless() Option

Borderless option makes the window borderless.

func Maximized

func Maximized() Option

Maximized option makes the window start maximized.

func Resizable

func Resizable() Option

Resizable option makes the window resizable by the user.

func Size

func Size(width, height int) Option

Size option sets the width and height of the window.

func Title

func Title(title string) Option

Title option sets the title (caption) of the window.

type WiClose

type WiClose struct{}

WiClose is an event that happens when the user presses the close button on the window.

func (WiClose) String

func (wc WiClose) String() string

type Win

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

Win is an Env that handles an actual graphical window.

It receives its events from the OS and it draws to the surface of the window.

Warning: only one window can be open at a time. This will be fixed.

func New

func New(opts ...Option) (*Win, error)

New creates a new window with all the supplied options.

The default title is empty and the default size is 640x480.

func (*Win) Draw

func (w *Win) Draw() chan<- func(draw.Image) image.Rectangle

Draw returns the draw channel of the window.

func (*Win) Events

func (w *Win) Events() <-chan gui.Event

Events returns the events channel of the window.

Jump to

Keyboard shortcuts

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