win

package
v0.0.0-...-b040a80 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 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 int
}

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

func (KbDown) GetKey

func (kd KbDown) GetKey() int

func (KbDown) String

func (kd KbDown) String() string

type KbRepeat

type KbRepeat struct{ Key int }

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) GetKey

func (kr KbRepeat) GetKey() int

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) GetKey

func (kt KbType) GetKey() int

func (KbType) String

func (kt KbType) String() string

type KbUp

type KbUp struct{ Key int }

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

func (KbUp) GetKey

func (ku KbUp) GetKey() int

func (KbUp) String

func (ku KbUp) String() string

type Key

type Key int

Key indicates a keyboard key in an event.

type MoDown

type MoDown struct {
	image.Point
	Button Button
}

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

func (MoDown) GetKey

func (md MoDown) GetKey() int

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) GetKey

func (mm MoMove) GetKey() int

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) GetKey

func (ms MoScroll) GetKey() int

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) GetKey

func (mu MoUp) GetKey() int

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) GetKey

func (wc WiClose) GetKey() int

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