glfw

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

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)
	MouseButton3      = MouseButton(3)
	MouseButton4      = MouseButton(4)
)
View Source
const (
	AutoIconify            = Hint(0x00020006)
	ClientAPI              = Hint(0x00022001)
	ContextCreationAPI     = Hint(0x0002200B)
	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
	EGLContextAPI  = 0x00036002
	NoAPI          = 0
	OpenGLAPI      = 0x00030001
	OpenGLESAPI    = 0x00030002
)
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)
)

Variables

This section is empty.

Functions

func GetKeyName added in v2.5.0

func GetKeyName(key Key, scancode int) string

func Init

func Init() error

func PollEvents

func PollEvents()

func PostEmptyEvent added in v2.2.0

func PostEmptyEvent()

func SwapInterval

func SwapInterval(interval int)

func Terminate

func Terminate()

func WaitEvents added in v2.2.0

func WaitEvents()

func WaitEventsTimeout added in v2.2.0

func WaitEventsTimeout(timeout float64)

func WindowHint

func WindowHint(target Hint, hint int)

Types

type Action

type Action int

type CharModsCallback

type CharModsCallback = glfw.CharModsCallback

func ToCharModsCallback added in v2.1.2

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

type CloseCallback added in v2.2.0

type CloseCallback = glfw.CloseCallback

func ToCloseCallback added in v2.2.0

func ToCloseCallback(cb func(window *Window)) CloseCallback

type Cursor added in v2.1.0

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

func CreateStandardCursor added in v2.1.0

func CreateStandardCursor(shape StandardCursor) *Cursor

type DropCallback added in v2.5.0

type DropCallback = glfw.DropCallback

func ToDropCallback added in v2.5.0

func ToDropCallback(cb func(window *Window, names []string)) DropCallback

type ErrorCode

type ErrorCode int

func (ErrorCode) String

func (e ErrorCode) String() string

type FramebufferSizeCallback

type FramebufferSizeCallback = glfw.FramebufferSizeCallback

func ToFramebufferSizeCallback added in v2.1.2

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

type Hint

type Hint int

type InputMode

type InputMode int

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, error)

func (*Monitor) GetPos

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

func (*Monitor) GetVideoMode

func (m *Monitor) GetVideoMode() *VidMode

type MonitorCallback added in v2.4.0

type MonitorCallback = glfw.MonitorCallback

func SetMonitorCallback

func SetMonitorCallback(cbfun MonitorCallback) MonitorCallback

func ToMonitorCallback added in v2.4.0

func ToMonitorCallback(cb func(monitor *Monitor, event PeripheralEvent)) MonitorCallback

type MouseButton

type MouseButton int

type PeripheralEvent

type PeripheralEvent int

type ScrollCallback

type ScrollCallback = glfw.ScrollCallback

func ToScrollCallback added in v2.1.2

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

type SizeCallback

type SizeCallback = glfw.SizeCallback

func ToSizeCallback added in v2.1.2

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

type StandardCursor added in v2.1.0

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) Focus added in v2.4.0

func (w *Window) Focus()

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) Hide added in v2.2.0

func (w *Window) Hide()

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) SetAspectRatio added in v2.3.0

func (w *Window) SetAspectRatio(numer, denom int)

func (*Window) SetAttrib

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

func (*Window) SetCharModsCallback

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

func (*Window) SetCloseCallback added in v2.2.0

func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback)

func (*Window) SetCursor added in v2.1.0

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

func (*Window) SetDropCallback added in v2.5.0

func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback)

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) SetShouldClose added in v2.2.0

func (w *Window) SetShouldClose(value bool)

func (*Window) SetSize

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

func (*Window) SetSizeCallback

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

func (*Window) SetSizeLimits added in v2.1.0

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
y or Y : Canonical URL