Documentation
¶
Overview ¶
Package app provides the ability to run a window.
A minimum window instance must implements Window interface that require a Size method to provide the size of the window. If the window instance additionaly implements a Draw method that returns an image.RGBA pointer, the created window will draw the provided image on the window.
To handle resize, keyboard, and mouse events, the window instance must additionally implements OnResize, OnKey and OnMouse methods. See ResizeHandler, KeyboardHandler, and MouseHandler interfaces.
Platform Specific Dependencies ¶
- Darwin: xcode-install --select - Linux: sudo apt install -y libx11-dev libgles2-mesa-dev libegl1-mesa-dev
Index ¶
Constants ¶
const ( ModNone = ModifierKey(0) ModShift = ModifierKey(1 << 0) ModCapsLock = ModifierKey(1 << 1) ModControl = ModifierKey(1 << 2) Mod1 = ModifierKey(1 << 3) Mod2 = ModifierKey(1 << 4) Mod3 = ModifierKey(1 << 5) Mod4 = ModifierKey(1 << 6) Mod5 = ModifierKey(1 << 7) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DrawHandler ¶
DrawHandler is an extended interface of a Window which presents a method to draw an image to show on top of the window.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key corresponds to a keyboard key.
type KeyEvent ¶
type KeyEvent struct {
Keycode Key
Mods ModifierKey
Pressed bool
}
KeyEvent describes a key event over the window
type KeyboardHanlder ¶
KeyboardHanlder is an extended Interface of a Window which presents a method to handle keyboard inputs.
type ModifierKey ¶
type ModifierKey int
ModifierKey corresponds to a set of modifier keys (bitmask). The provided modifiers are platform dependent.
func (ModifierKey) Contain ¶
func (mod ModifierKey) Contain(mod2 ModifierKey) bool
func (ModifierKey) String ¶
func (mod ModifierKey) String() string
type MouseAction ¶
type MouseAction int
MouseAction corresponds to a mouse action.
const ( MouseMove MouseAction = iota MouseUp MouseDown MouseScroll )
func (MouseAction) String ¶
func (a MouseAction) String() string
type MouseButton ¶
type MouseButton int
MouseButton corresponds to a mouse button.
const ( MouseBtnNone MouseButton = iota MouseBtnLeft MouseBtnRight MouseBtnMiddle )
Mouse buttons
func (MouseButton) String ¶
func (btn MouseButton) String() string
type MouseEvent ¶
type MouseEvent struct {
Action MouseAction
Button MouseButton
Mods ModifierKey
Xpos float32
Ypos float32
Xoffset float32
Yoffset float32
}
MouseEvent describes a mouse event over the window
func (MouseEvent) String ¶
func (mev MouseEvent) String() string
type MouseHandler ¶
type MouseHandler interface {
Window
OnMouse(mo MouseEvent)
}
MouseHandler is an extended Interface of a Window which presents a method to handle mouse inputs.
type Option ¶
type Option func(*config)
type ResizeHandler ¶
ResizeHandler is an extended Interface of a Window which presents a method to handle window resizes.
type SizeHandler ¶
SizeHandler is an extended interface of a Window which reports the desired size of a window.