Version: v2.1.3 Latest Latest

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0




View Source
const (
	DontCare = -1
	False    = 0
	True     = 1
View Source
const (
	Release = Action(0)
	Press   = Action(1)
	Repeat  = Action(2)
View Source
const (
	ModShift   = ModifierKey(0x0001)
	ModControl = ModifierKey(0x0002)
	ModAlt     = ModifierKey(0x0004)
View Source
const (
	MouseButtonLeft   = MouseButton(0)
	MouseButtonRight  = MouseButton(1)
	MouseButtonMiddle = MouseButton(2)
View Source
const (
	Joystick1  = Joystick(0)
	Joystick2  = Joystick(1)
	Joystick3  = Joystick(2)
	Joystick4  = Joystick(3)
	Joystick5  = Joystick(4)
	Joystick6  = Joystick(5)
	Joystick7  = Joystick(6)
	Joystick8  = Joystick(7)
	Joystick9  = Joystick(8)
	Joystick10 = Joystick(9)
	Joystick11 = Joystick(10)
	Joystick12 = Joystick(11)
	Joystick13 = Joystick(12)
	Joystick14 = Joystick(13)
	Joystick15 = Joystick(14)
	Joystick16 = Joystick(15)
View Source
const (
	ClientAPI              = Hint(0x00022001)
	ContextVersionMajor    = Hint(0x00022002)
	ContextVersionMinor    = Hint(0x00022003)
	Decorated              = Hint(0x00020005)
	Floating               = Hint(0x00020007)
	Focused                = Hint(0x00020001)
	FocusOnShow            = Hint(0x0002000C)
	Iconified              = Hint(0x00020002)
	Maximized              = Hint(0x00020008)
	Resizable              = Hint(0x00020003)
	TransparentFramebuffer = Hint(0x0002000A)
	Visible                = Hint(0x00020004)
View Source
const (
	CursorMode             = InputMode(0x00033001)
	StickyKeysMode         = InputMode(0x00033002)
	StickyMouseButtonsMode = InputMode(0x00033003)
View Source
const (
	CursorDisabled = 0x00034003
	CursorHidden   = 0x00034002
	CursorNormal   = 0x00034001
	NoAPI          = 0
	OpenGLAPI      = 0x00030001
View Source
const (
	NotInitialized     = ErrorCode(0x00010001)
	NoCurrentContext   = ErrorCode(0x00010002)
	InvalidEnum        = ErrorCode(0x00010003)
	InvalidValue       = ErrorCode(0x00010004)
	OutOfMemory        = ErrorCode(0x00010005)
	APIUnavailable     = ErrorCode(0x00010006)
	VersionUnavailable = ErrorCode(0x00010007)
	PlatformError      = ErrorCode(0x00010008)
	FormatUnavailable  = ErrorCode(0x00010009)
	NoWindowContext    = ErrorCode(0x0001000A)
View Source
const (
	ArrowCursor     = StandardCursor(0x00036001)
	IBeamCursor     = StandardCursor(0x00036002)
	CrosshairCursor = StandardCursor(0x00036003)
	HandCursor      = StandardCursor(0x00036004)
	HResizeCursor   = StandardCursor(0x00036005)
	VResizeCursor   = StandardCursor(0x00036006)
View Source
const (
	Key0            = Key(48)
	Key1            = Key(49)
	Key2            = Key(50)
	Key3            = Key(51)
	Key4            = Key(52)
	Key5            = Key(53)
	Key6            = Key(54)
	Key7            = Key(55)
	Key8            = Key(56)
	Key9            = Key(57)
	KeyA            = Key(65)
	KeyApostrophe   = Key(39)
	KeyB            = Key(66)
	KeyBackslash    = Key(92)
	KeyBackspace    = Key(259)
	KeyC            = Key(67)
	KeyCapsLock     = Key(280)
	KeyComma        = Key(44)
	KeyD            = Key(68)
	KeyDelete       = Key(261)
	KeyDown         = Key(264)
	KeyE            = Key(69)
	KeyEnd          = Key(269)
	KeyEnter        = Key(257)
	KeyEqual        = Key(61)
	KeyEscape       = Key(256)
	KeyF            = Key(70)
	KeyF1           = Key(290)
	KeyF10          = Key(299)
	KeyF11          = Key(300)
	KeyF12          = Key(301)
	KeyF2           = Key(291)
	KeyF3           = Key(292)
	KeyF4           = Key(293)
	KeyF5           = Key(294)
	KeyF6           = Key(295)
	KeyF7           = Key(296)
	KeyF8           = Key(297)
	KeyF9           = Key(298)
	KeyG            = Key(71)
	KeyGraveAccent  = Key(96)
	KeyH            = Key(72)
	KeyHome         = Key(268)
	KeyI            = Key(73)
	KeyInsert       = Key(260)
	KeyJ            = Key(74)
	KeyK            = Key(75)
	KeyKP0          = Key(320)
	KeyKP1          = Key(321)
	KeyKP2          = Key(322)
	KeyKP3          = Key(323)
	KeyKP4          = Key(324)
	KeyKP5          = Key(325)
	KeyKP6          = Key(326)
	KeyKP7          = Key(327)
	KeyKP8          = Key(328)
	KeyKP9          = Key(329)
	KeyKPAdd        = Key(334)
	KeyKPDecimal    = Key(330)
	KeyKPDivide     = Key(331)
	KeyKPEnter      = Key(335)
	KeyKPEqual      = Key(336)
	KeyKPMultiply   = Key(332)
	KeyKPSubtract   = Key(333)
	KeyL            = Key(76)
	KeyLast         = Key(348)
	KeyLeft         = Key(263)
	KeyLeftAlt      = Key(342)
	KeyLeftBracket  = Key(91)
	KeyLeftControl  = Key(341)
	KeyLeftShift    = Key(340)
	KeyLeftSuper    = Key(343)
	KeyM            = Key(77)
	KeyMenu         = Key(348)
	KeyMinus        = Key(45)
	KeyN            = Key(78)
	KeyNumLock      = Key(282)
	KeyO            = Key(79)
	KeyP            = Key(80)
	KeyPageDown     = Key(267)
	KeyPageUp       = Key(266)
	KeyPause        = Key(284)
	KeyPeriod       = Key(46)
	KeyPrintScreen  = Key(283)
	KeyQ            = Key(81)
	KeyR            = Key(82)
	KeyRight        = Key(262)
	KeyRightAlt     = Key(346)
	KeyRightBracket = Key(93)
	KeyRightControl = Key(345)
	KeyRightShift   = Key(344)
	KeyRightSuper   = Key(347)
	KeyS            = Key(83)
	KeyScrollLock   = Key(281)
	KeySemicolon    = Key(59)
	KeySlash        = Key(47)
	KeySpace        = Key(32)
	KeyT            = Key(84)
	KeyTab          = Key(258)
	KeyU            = Key(85)
	KeyUnknown      = Key(-1)
	KeyUp           = Key(265)
	KeyV            = Key(86)
	KeyW            = Key(87)
	KeyWorld1       = Key(161)
	KeyWorld2       = Key(162)
	KeyX            = Key(88)
	KeyY            = Key(89)
	KeyZ            = Key(90)


This section is empty.


func Init

func Init() error

func PollEvents

func PollEvents()

func SetMonitorCallback

func SetMonitorCallback(cbfun func(monitor *Monitor, event PeripheralEvent))

func SwapInterval

func SwapInterval(interval int)

func Terminate

func Terminate()

func WindowHint

func WindowHint(target Hint, hint int)


type Action

type Action int

type CharModsCallback

type CharModsCallback uintptr

func ToCharModsCallback

func ToCharModsCallback(cb func(window *Window, char rune, mods ModifierKey)) CharModsCallback

type Cursor

type Cursor struct {
	// contains filtered or unexported fields

func CreateStandardCursor

func CreateStandardCursor(shape StandardCursor) *Cursor

type ErrorCode

type ErrorCode int

func (ErrorCode) String

func (e ErrorCode) String() string

type FramebufferSizeCallback

type FramebufferSizeCallback uintptr

func ToFramebufferSizeCallback

func ToFramebufferSizeCallback(cb func(window *Window, width int, height int)) FramebufferSizeCallback

type Hint

type Hint int

type InputMode

type InputMode int

type Joystick

type Joystick int

func (Joystick) GetAxes

func (j Joystick) GetAxes() []float32

func (Joystick) GetButtons

func (j Joystick) GetButtons() []Action

func (Joystick) GetGUID

func (j Joystick) GetGUID() string

func (Joystick) GetName

func (j Joystick) GetName() string

func (Joystick) Present

func (j Joystick) Present() bool

type Key

type Key int

type ModifierKey

type ModifierKey int

type Monitor

type Monitor struct {
	// contains filtered or unexported fields

func GetMonitors

func GetMonitors() []*Monitor

func GetPrimaryMonitor

func GetPrimaryMonitor() *Monitor

func (*Monitor) GetContentScale

func (m *Monitor) GetContentScale() (float32, float32)

func (*Monitor) GetPos

func (m *Monitor) GetPos() (x, y int)

func (*Monitor) GetVideoMode

func (m *Monitor) GetVideoMode() *VidMode

type MouseButton

type MouseButton int

type PeripheralEvent

type PeripheralEvent int

type ScrollCallback

type ScrollCallback uintptr

func ToScrollCallback

func ToScrollCallback(cb func(window *Window, xoff float64, yoff float64)) ScrollCallback

type SizeCallback

type SizeCallback uintptr

func ToSizeCallback

func ToSizeCallback(cb func(window *Window, width int, height int)) SizeCallback

type StandardCursor

type StandardCursor int

type VidMode

type VidMode struct {
	Width       int
	Height      int
	RedBits     int
	GreenBits   int
	BlueBits    int
	RefreshRate int

type Window

type Window struct {
	// contains filtered or unexported fields

func CreateWindow

func CreateWindow(width, height int, title string, monitor *Monitor, share *Window) (*Window, error)

func (*Window) Destroy

func (w *Window) Destroy()

func (*Window) GetAttrib

func (w *Window) GetAttrib(attrib Hint) int

func (*Window) GetCursorPos

func (w *Window) GetCursorPos() (x, y float64)

func (*Window) GetInputMode

func (w *Window) GetInputMode(mode InputMode) int

func (*Window) GetKey

func (w *Window) GetKey(key Key) Action

func (*Window) GetMonitor

func (w *Window) GetMonitor() *Monitor

func (*Window) GetMouseButton

func (w *Window) GetMouseButton(button MouseButton) Action

func (*Window) GetPos

func (w *Window) GetPos() (x, y int)

func (*Window) GetSize

func (w *Window) GetSize() (width, height int)

func (*Window) Iconify

func (w *Window) Iconify()

func (*Window) MakeContextCurrent

func (w *Window) MakeContextCurrent()

func (*Window) Maximize

func (w *Window) Maximize()

func (*Window) Restore

func (w *Window) Restore()

func (*Window) SetAttrib

func (w *Window) SetAttrib(attrib Hint, value int)

func (*Window) SetCharModsCallback

func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback)

func (*Window) SetCursor

func (w *Window) SetCursor(cursor *Cursor)

func (*Window) SetFramebufferSizeCallback

func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (previous FramebufferSizeCallback)

func (*Window) SetIcon

func (w *Window) SetIcon(images []image.Image)

func (*Window) SetInputMode

func (w *Window) SetInputMode(mode InputMode, value int)

func (*Window) SetMonitor

func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int)

func (*Window) SetPos

func (w *Window) SetPos(xpos, ypos int)

func (*Window) SetScrollCallback

func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallback)

func (*Window) SetSize

func (w *Window) SetSize(width, height int)

func (*Window) SetSizeCallback

func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback)

func (*Window) SetSizeLimits

func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int)

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

func (*Window) ShouldClose

func (w *Window) ShouldClose() bool

func (*Window) Show

func (w *Window) Show()

func (*Window) SwapBuffers

func (w *Window) SwapBuffers()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto