goglfw

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: 13 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	NoAPI       = 0
	OpenGLAPI   = 0x00030001
	OpenGLESAPI = 0x00030002

	NoRobustness        = 0
	NoResetNotification = 0x00031001
	LoseContextOnReset  = 0x00031002

	OpenGLAnyProfile    = 0
	OpenGLCoreProfile   = 0x00032001
	OpenGLCompatProfile = 0x00032002

	CursorNormal   = 0x00034001
	CursorHidden   = 0x00034002
	CursorDisabled = 0x00034003

	AnyReleaseBehavior   = 0
	ReleaseBehaviorFlush = 0x00035001
	ReleaseBehaviorNone  = 0x00035002

	NativeContextAPI = 0x00036001
	EGLContextAPI    = 0x00036002
	OSMesaContextAPI = 0x00036003

	DontCare = -1
)

Variables

This section is empty.

Functions

func ExtensionSupported

func ExtensionSupported(extension string) (bool, error)

func GetClipboardString

func GetClipboardString() (string, error)

func GetKeyName

func GetKeyName(key Key, scancode int) (string, error)

func GetKeyScancode

func GetKeyScancode(key Key) (int, error)

func Init

func Init() (ferr error)

func PollEvents

func PollEvents() error

func PostEmptyEvent

func PostEmptyEvent() error

func RawMouseMotionSupported

func RawMouseMotionSupported() (bool, error)

func SwapInterval

func SwapInterval(interval int) error

func Terminate

func Terminate() error

func WaitEvents

func WaitEvents() error

func WaitEventsTimeout

func WaitEventsTimeout(timeout float64) error

func WindowHint

func WindowHint(hint Hint, value int) error

Types

type Action

type Action int
const (
	Release Action = 0
	Press   Action = 1
	Repeat  Action = 2
)

type CharCallback

type CharCallback func(w *Window, char rune)

type CharModsCallback

type CharModsCallback func(w *Window, char rune, mods ModifierKey)

type CloseCallback

type CloseCallback func(w *Window)

type ContentScaleCallback

type ContentScaleCallback func(w *Window, x float32, y float32)

type Cursor

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

func CreateStandardCursor

func CreateStandardCursor(shape StandardCursor) (*Cursor, error)

func (*Cursor) Destroy

func (c *Cursor) Destroy() error

type CursorEnterCallback

type CursorEnterCallback func(w *Window, entered bool)

type CursorPosCallback

type CursorPosCallback func(w *Window, xpos float64, ypos float64)

type DropCallback

type DropCallback func(w *Window, names []string)

type Error

type Error int
var (
	NotInitialized     Error = 0x00010001
	NoCurrentContext   Error = 0x00010002
	InvalidEnum        Error = 0x00010003
	InvalidValue       Error = 0x00010004
	OutOfMemory        Error = 0x00010005
	ApiUnavailable     Error = 0x00010006
	VersionUnavailable Error = 0x00010007
	PlatformError      Error = 0x00010008
	FormatUnavailable  Error = 0x00010009
	NoWindowContext    Error = 0x0001000A
)

func (Error) Error

func (e Error) Error() string

type FocusCallback

type FocusCallback func(w *Window, focused bool)

type FramebufferSizeCallback

type FramebufferSizeCallback func(w *Window, width int, height int)

type Hint

type Hint int
const (
	Focused                Hint = 0x00020001
	Iconified              Hint = 0x00020002
	Resizable              Hint = 0x00020003
	Visible                Hint = 0x00020004
	Decorated              Hint = 0x00020005
	AutoIconify            Hint = 0x00020006
	Floating               Hint = 0x00020007
	Maximized              Hint = 0x00020008
	CenterCursor           Hint = 0x00020009
	TransparentFramebuffer Hint = 0x0002000A
	Hovered                Hint = 0x0002000B
	FocusOnShow            Hint = 0x0002000C

	RedBits        Hint = 0x00021001
	GreenBits      Hint = 0x00021002
	BlueBits       Hint = 0x00021003
	AlphaBits      Hint = 0x00021004
	DepthBits      Hint = 0x00021005
	StencilBits    Hint = 0x00021006
	AccumRedBits   Hint = 0x00021007
	AccumGreenBits Hint = 0x00021008
	AccumBlueBits  Hint = 0x00021009
	AccumAlphaBits Hint = 0x0002100A
	AuxBuffers     Hint = 0x0002100B
	Stereo         Hint = 0x0002100C
	Samples        Hint = 0x0002100D
	SRGBCapable    Hint = 0x0002100E
	RefreshRate    Hint = 0x0002100F
	DoubleBuffer   Hint = 0x00021010

	ClientAPI              Hint = 0x00022001
	ContextVersionMajor    Hint = 0x00022002
	ContextVersionMinor    Hint = 0x00022003
	ContextRevision        Hint = 0x00022004
	ContextRobustness      Hint = 0x00022005
	OpenGLForwardCompat    Hint = 0x00022006
	OpenGLDebugContext     Hint = 0x00022007
	OpenGLProfile          Hint = 0x00022008
	ContextReleaseBehavior Hint = 0x00022009
	ContextNoError         Hint = 0x0002200A
	ContextCreationAPI     Hint = 0x0002200B
	ScaleToMonitor         Hint = 0x0002200C
)

type IconifyCallback

type IconifyCallback func(w *Window, iconified bool)

type Image

type Image struct {
	Width  int
	Height int
	Pixels []byte
}

type InputMode

type InputMode int
const (
	CursorMode             InputMode = 0x00033001
	StickyKeysMode         InputMode = 0x00033002
	StickyMouseButtonsMode InputMode = 0x00033003
	LockKeyMods            InputMode = 0x00033004
	RawMouseMotion         InputMode = 0x00033005
)

type Key

type Key int
const (
	KeyUnknown Key = -1

	// Printable keys
	KeySpace        Key = 32
	KeyApostrophe   Key = 39 // '
	KeyComma        Key = 44 // ,
	KeyMinus        Key = 45 // -
	KeyPeriod       Key = 46 // .
	KeySlash        Key = 47 // /
	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
	KeySemicolon    Key = 59 // ;
	KeyEqual        Key = 61 // =
	KeyA            Key = 65
	KeyB            Key = 66
	KeyC            Key = 67
	KeyD            Key = 68
	KeyE            Key = 69
	KeyF            Key = 70
	KeyG            Key = 71
	KeyH            Key = 72
	KeyI            Key = 73
	KeyJ            Key = 74
	KeyK            Key = 75
	KeyL            Key = 76
	KeyM            Key = 77
	KeyN            Key = 78
	KeyO            Key = 79
	KeyP            Key = 80
	KeyQ            Key = 81
	KeyR            Key = 82
	KeyS            Key = 83
	KeyT            Key = 84
	KeyU            Key = 85
	KeyV            Key = 86
	KeyW            Key = 87
	KeyX            Key = 88
	KeyY            Key = 89
	KeyZ            Key = 90
	KeyLeftBracket  Key = 91  // [
	KeyBackslash    Key = 92  // \
	KeyRightBracket Key = 93  // ]
	KeyGraveAccent  Key = 96  // `
	KeyWorld1       Key = 161 // non-US #1
	KeyWorld2       Key = 162 // non-US #2

	// Function keys
	KeyEscape       Key = 256
	KeyEnter        Key = 257
	KeyTab          Key = 258
	KeyBackspace    Key = 259
	KeyInsert       Key = 260
	KeyDelete       Key = 261
	KeyRight        Key = 262
	KeyLeft         Key = 263
	KeyDown         Key = 264
	KeyUp           Key = 265
	KeyPageUp       Key = 266
	KeyPageDown     Key = 267
	KeyHome         Key = 268
	KeyEnd          Key = 269
	KeyCapsLock     Key = 280
	KeyScrollLock   Key = 281
	KeyNumLock      Key = 282
	KeyPrintScreen  Key = 283
	KeyPause        Key = 284
	KeyF1           Key = 290
	KeyF2           Key = 291
	KeyF3           Key = 292
	KeyF4           Key = 293
	KeyF5           Key = 294
	KeyF6           Key = 295
	KeyF7           Key = 296
	KeyF8           Key = 297
	KeyF9           Key = 298
	KeyF10          Key = 299
	KeyF11          Key = 300
	KeyF12          Key = 301
	KeyF13          Key = 302
	KeyF14          Key = 303
	KeyF15          Key = 304
	KeyF16          Key = 305
	KeyF17          Key = 306
	KeyF18          Key = 307
	KeyF19          Key = 308
	KeyF20          Key = 309
	KeyF21          Key = 310
	KeyF22          Key = 311
	KeyF23          Key = 312
	KeyF24          Key = 313
	KeyF25          Key = 314
	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
	KeyKPDecimal    Key = 330
	KeyKPDivide     Key = 331
	KeyKPMultiply   Key = 332
	KeyKPSubtract   Key = 333
	KeyKPAdd        Key = 334
	KeyKPEnter      Key = 335
	KeyKPEqual      Key = 336
	KeyLeftShift    Key = 340
	KeyLeftControl  Key = 341
	KeyLeftAlt      Key = 342
	KeyLeftSuper    Key = 343
	KeyRightShift   Key = 344
	KeyRightControl Key = 345
	KeyRightAlt     Key = 346
	KeyRightSuper   Key = 347
	KeyMenu         Key = 348

	KeyLast Key = KeyMenu
)

type KeyCallback

type KeyCallback func(w *Window, key Key, scancode int, action Action, mods ModifierKey)

type MaximizeCallback

type MaximizeCallback func(w *Window, iconified bool)

type ModifierKey

type ModifierKey int
const (
	ModShift    ModifierKey = 0x0001
	ModControl  ModifierKey = 0x0002
	ModAlt      ModifierKey = 0x0004
	ModSuper    ModifierKey = 0x0008
	ModCapsLock ModifierKey = 0x0010
	ModNumLock  ModifierKey = 0x0020
)

type Monitor

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

func GetMonitors

func GetMonitors() ([]*Monitor, error)

func GetPrimaryMonitor

func GetPrimaryMonitor() (*Monitor, error)

func (*Monitor) GetContentScale

func (m *Monitor) GetContentScale() (xscale, yscale float32, err error)

func (*Monitor) GetName

func (m *Monitor) GetName() (string, error)

func (*Monitor) GetPos

func (m *Monitor) GetPos() (xpos, ypos int, err error)

func (*Monitor) GetVideoMode

func (m *Monitor) GetVideoMode() (*VidMode, error)

func (*Monitor) GetVideoModes

func (m *Monitor) GetVideoModes() ([]*VidMode, error)

func (*Monitor) GetWorkarea

func (m *Monitor) GetWorkarea() (xpos, ypos, width, height int, err error)

type MonitorCallback

type MonitorCallback func(monitor *Monitor, event PeripheralEvent)

func SetMonitorCallback

func SetMonitorCallback(cbfun MonitorCallback) (MonitorCallback, error)

type MouseButton

type MouseButton int
const (
	MouseButton1      MouseButton = 0
	MouseButton2      MouseButton = 1
	MouseButton3      MouseButton = 2
	MouseButton4      MouseButton = 3
	MouseButton5      MouseButton = 4
	MouseButton6      MouseButton = 5
	MouseButton7      MouseButton = 6
	MouseButton8      MouseButton = 7
	MouseButtonLast   MouseButton = MouseButton8
	MouseButtonLeft   MouseButton = MouseButton1
	MouseButtonRight  MouseButton = MouseButton2
	MouseButtonMiddle MouseButton = MouseButton3
)

type MouseButtonCallback

type MouseButtonCallback func(w *Window, button MouseButton, action Action, mods ModifierKey)

type PeripheralEvent

type PeripheralEvent int
const (
	Connected    PeripheralEvent = 0x00040001
	Disconnected PeripheralEvent = 0x00040002
)

type PosCallback

type PosCallback func(w *Window, xpos int, ypos int)

type RefreshCallback

type RefreshCallback func(w *Window)

type ScrollCallback

type ScrollCallback func(w *Window, xoff float64, yoff float64)

type SizeCallback

type SizeCallback func(w *Window, width int, height int)

type StandardCursor

type StandardCursor int
const (
	ArrowCursor     StandardCursor = 0x00036001
	IBeamCursor     StandardCursor = 0x00036002
	CrosshairCursor StandardCursor = 0x00036003
	HandCursor      StandardCursor = 0x00036004
	HResizeCursor   StandardCursor = 0x00036005
	VResizeCursor   StandardCursor = 0x00036006
)

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 *Window, ferr error)

func GetCurrentContext

func GetCurrentContext() (*Window, error)

func (*Window) Destroy

func (w *Window) Destroy() error

func (*Window) Focus

func (w *Window) Focus() error

func (*Window) GetAttrib

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

func (*Window) GetContentScale

func (w *Window) GetContentScale() (xscale, yscale float32, err error)

func (*Window) GetCursorPos

func (w *Window) GetCursorPos() (xpos, ypos float64, err error)

func (*Window) GetFrameSize

func (w *Window) GetFrameSize() (left, top, right, bottom int, err error)

func (*Window) GetFramebufferSize

func (w *Window) GetFramebufferSize() (width, height int, err error)

func (*Window) GetInputMode

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

func (*Window) GetKey

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

func (*Window) GetMonitor

func (w *Window) GetMonitor() (*Monitor, error)

func (*Window) GetMouseButton

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

func (*Window) GetOpacity

func (w *Window) GetOpacity() (float32, error)

func (*Window) GetPos

func (w *Window) GetPos() (xpos, ypos int, err error)

func (*Window) GetSize

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

func (*Window) GetUserPointer

func (w *Window) GetUserPointer() (unsafe.Pointer, error)

func (*Window) GetWin32Window

func (w *Window) GetWin32Window() (windows.HWND, error)

func (*Window) Hide

func (w *Window) Hide() error

func (*Window) Iconify

func (w *Window) Iconify() error

func (*Window) MakeContextCurrent

func (w *Window) MakeContextCurrent() error

func (*Window) Maximize

func (w *Window) Maximize() error

func (*Window) RequestAttention

func (w *Window) RequestAttention() error

func (*Window) Restore

func (w *Window) Restore() error

func (*Window) SetAspectRatio

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

func (*Window) SetAttrib

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

func (*Window) SetCharCallback

func (w *Window) SetCharCallback(cbfun CharCallback) (CharCallback, error)

func (*Window) SetCharModsCallback

func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (CharModsCallback, error)

func (*Window) SetClipboardString

func (w *Window) SetClipboardString(str string) error

func (*Window) SetCloseCallback

func (w *Window) SetCloseCallback(cbfun CloseCallback) (CloseCallback, error)

func (*Window) SetContentScaleCallback

func (w *Window) SetContentScaleCallback(cbfun ContentScaleCallback) (ContentScaleCallback, error)

func (*Window) SetCursor

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

func (*Window) SetCursorEnterCallback

func (w *Window) SetCursorEnterCallback(cbfun CursorEnterCallback) (CursorEnterCallback, error)

func (*Window) SetCursorPos

func (w *Window) SetCursorPos(xpos, ypos float64) error

func (*Window) SetCursorPosCallback

func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (CursorPosCallback, error)

func (*Window) SetDropCallback

func (w *Window) SetDropCallback(cbfun DropCallback) (DropCallback, error)

func (*Window) SetFocusCallback

func (w *Window) SetFocusCallback(cbfun FocusCallback) (FocusCallback, error)

func (*Window) SetFramebufferSizeCallback

func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (FramebufferSizeCallback, error)

func (*Window) SetIcon

func (w *Window) SetIcon(images []*Image) error

func (*Window) SetIconifyCallback

func (w *Window) SetIconifyCallback(cbfun IconifyCallback) (IconifyCallback, error)

func (*Window) SetInputMode

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

func (*Window) SetKeyCallback

func (w *Window) SetKeyCallback(cbfun KeyCallback) (KeyCallback, error)

func (*Window) SetMaximizeCallback

func (w *Window) SetMaximizeCallback(cbfun MaximizeCallback) (MaximizeCallback, error)

func (*Window) SetMonitor

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

func (*Window) SetMouseButtonCallback

func (w *Window) SetMouseButtonCallback(cbfun MouseButtonCallback) (MouseButtonCallback, error)

func (*Window) SetOpacity

func (w *Window) SetOpacity(opacity float32) error

func (*Window) SetPos

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

func (*Window) SetPosCallback

func (w *Window) SetPosCallback(cbfun PosCallback) (PosCallback, error)

func (*Window) SetRefreshCallback

func (w *Window) SetRefreshCallback(cbfun RefreshCallback) (RefreshCallback, error)

func (*Window) SetScrollCallback

func (w *Window) SetScrollCallback(cbfun ScrollCallback) (ScrollCallback, error)

func (*Window) SetShouldClose

func (w *Window) SetShouldClose(value bool) error

func (*Window) SetSize

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

func (*Window) SetSizeCallback

func (w *Window) SetSizeCallback(cbfun SizeCallback) (SizeCallback, error)

func (*Window) SetSizeLimits

func (w *Window) SetSizeLimits(minwidth, minheight, maxwidth, maxheight int) error

func (*Window) SetTitle

func (w *Window) SetTitle(title string) error

func (*Window) SetUserPointer

func (w *Window) SetUserPointer(pointer unsafe.Pointer) error

func (*Window) ShouldClose

func (w *Window) ShouldClose() (bool, error)

func (*Window) Show

func (w *Window) Show() error

func (*Window) SwapBuffers

func (w *Window) SwapBuffers() error

Jump to

Keyboard shortcuts

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