window

package
v0.0.0-...-a112006 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package window abstracts the OpenGL Window manager Currently only "glfw" is supported

Index

Constants

View Source
const (
	KeyUnknown      = Key(glfw.KeyUnknown)
	KeySpace        = Key(glfw.KeySpace)
	KeyApostrophe   = Key(glfw.KeyApostrophe)
	KeyComma        = Key(glfw.KeyComma)
	KeyMinus        = Key(glfw.KeyMinus)
	KeyPeriod       = Key(glfw.KeyPeriod)
	KeySlash        = Key(glfw.KeySlash)
	Key0            = Key(glfw.Key0)
	Key1            = Key(glfw.Key1)
	Key2            = Key(glfw.Key2)
	Key3            = Key(glfw.Key3)
	Key4            = Key(glfw.Key4)
	Key5            = Key(glfw.Key5)
	Key6            = Key(glfw.Key6)
	Key7            = Key(glfw.Key7)
	Key8            = Key(glfw.Key8)
	Key9            = Key(glfw.Key8)
	KeySemicolon    = Key(glfw.KeySemicolon)
	KeyEqual        = Key(glfw.KeyEqual)
	KeyA            = Key(glfw.KeyA)
	KeyB            = Key(glfw.KeyB)
	KeyC            = Key(glfw.KeyC)
	KeyD            = Key(glfw.KeyD)
	KeyE            = Key(glfw.KeyE)
	KeyF            = Key(glfw.KeyF)
	KeyG            = Key(glfw.KeyG)
	KeyH            = Key(glfw.KeyH)
	KeyI            = Key(glfw.KeyI)
	KeyJ            = Key(glfw.KeyJ)
	KeyK            = Key(glfw.KeyK)
	KeyL            = Key(glfw.KeyL)
	KeyM            = Key(glfw.KeyM)
	KeyN            = Key(glfw.KeyN)
	KeyO            = Key(glfw.KeyO)
	KeyP            = Key(glfw.KeyP)
	KeyQ            = Key(glfw.KeyQ)
	KeyR            = Key(glfw.KeyR)
	KeyS            = Key(glfw.KeyS)
	KeyT            = Key(glfw.KeyT)
	KeyU            = Key(glfw.KeyU)
	KeyV            = Key(glfw.KeyV)
	KeyW            = Key(glfw.KeyW)
	KeyX            = Key(glfw.KeyX)
	KeyY            = Key(glfw.KeyY)
	KeyZ            = Key(glfw.KeyZ)
	KeyLeftBracket  = Key(glfw.KeyLeftBracket)
	KeyBackslash    = Key(glfw.KeyBackslash)
	KeyRightBracket = Key(glfw.KeyRightBracket)
	KeyGraveAccent  = Key(glfw.KeyGraveAccent)
	KeyWorld1       = Key(glfw.KeyWorld1)
	KeyWorld2       = Key(glfw.KeyWorld2)
	KeyEscape       = Key(glfw.KeyEscape)
	KeyEnter        = Key(glfw.KeyEnter)
	KeyTab          = Key(glfw.KeyTab)
	KeyBackspace    = Key(glfw.KeyBackspace)
	KeyInsert       = Key(glfw.KeyInsert)
	KeyDelete       = Key(glfw.KeyDelete)
	KeyRight        = Key(glfw.KeyRight)
	KeyLeft         = Key(glfw.KeyLeft)
	KeyDown         = Key(glfw.KeyDown)
	KeyUp           = Key(glfw.KeyUp)
	KeyPageUp       = Key(glfw.KeyPageUp)
	KeyPageDown     = Key(glfw.KeyPageDown)
	KeyHome         = Key(glfw.KeyHome)
	KeyEnd          = Key(glfw.KeyEnd)
	KeyCapsLock     = Key(glfw.KeyCapsLock)
	KeyScrollLock   = Key(glfw.KeyScrollLock)
	KeyNumLock      = Key(glfw.KeyNumLock)
	KeyPrintScreen  = Key(glfw.KeyPrintScreen)
	KeyPause        = Key(glfw.KeyPause)
	KeyF1           = Key(glfw.KeyF1)
	KeyF2           = Key(glfw.KeyF2)
	KeyF3           = Key(glfw.KeyF3)
	KeyF4           = Key(glfw.KeyF4)
	KeyF5           = Key(glfw.KeyF5)
	KeyF6           = Key(glfw.KeyF6)
	KeyF7           = Key(glfw.KeyF7)
	KeyF8           = Key(glfw.KeyF8)
	KeyF9           = Key(glfw.KeyF9)
	KeyF10          = Key(glfw.KeyF10)
	KeyF11          = Key(glfw.KeyF11)
	KeyF12          = Key(glfw.KeyF12)
	KeyF13          = Key(glfw.KeyF13)
	KeyF14          = Key(glfw.KeyF14)
	KeyF15          = Key(glfw.KeyF15)
	KeyF16          = Key(glfw.KeyF16)
	KeyF17          = Key(glfw.KeyF17)
	KeyF18          = Key(glfw.KeyF18)
	KeyF19          = Key(glfw.KeyF19)
	KeyF20          = Key(glfw.KeyF20)
	KeyF21          = Key(glfw.KeyF21)
	KeyF22          = Key(glfw.KeyF22)
	KeyF23          = Key(glfw.KeyF23)
	KeyF24          = Key(glfw.KeyF24)
	KeyF25          = Key(glfw.KeyF25)
	KeyKP0          = Key(glfw.KeyKP0)
	KeyKP1          = Key(glfw.KeyKP1)
	KeyKP2          = Key(glfw.KeyKP2)
	KeyKP3          = Key(glfw.KeyKP3)
	KeyKP4          = Key(glfw.KeyKP4)
	KeyKP5          = Key(glfw.KeyKP5)
	KeyKP6          = Key(glfw.KeyKP6)
	KeyKP7          = Key(glfw.KeyKP7)
	KeyKP8          = Key(glfw.KeyKP8)
	KeyKP9          = Key(glfw.KeyKP9)
	KeyKPDecimal    = Key(glfw.KeyKPDecimal)
	KeyKPDivide     = Key(glfw.KeyKPDivide)
	KeyKPMultiply   = Key(glfw.KeyKPMultiply)
	KeyKPSubtract   = Key(glfw.KeyKPSubtract)
	KeyKPAdd        = Key(glfw.KeyKPAdd)
	KeyKPEnter      = Key(glfw.KeyKPEnter)
	KeyKPEqual      = Key(glfw.KeyKPEqual)
	KeyLeftShift    = Key(glfw.KeyLeftShift)
	KeyLeftControl  = Key(glfw.KeyLeftControl)
	KeyLeftAlt      = Key(glfw.KeyLeftAlt)
	KeyLeftSuper    = Key(glfw.KeyLeftSuper)
	KeyRightShift   = Key(glfw.KeyRightShift)
	KeyRightControl = Key(glfw.KeyRightControl)
	KeyRightAlt     = Key(glfw.KeyRightAlt)
	KeyRightSuper   = Key(glfw.KeyRightSuper)
	KeyMenu         = Key(glfw.KeyMenu)
	KeyLast         = Key(glfw.KeyLast)
)

Keycodes (from glfw)

View Source
const (
	ModShift   = ModifierKey(glfw.ModShift)
	ModControl = ModifierKey(glfw.ModControl)
	ModAlt     = ModifierKey(glfw.ModAlt)
	ModSuper   = ModifierKey(glfw.ModSuper)
)

Modifier keys

View Source
const (
	MouseButton1      = MouseButton(glfw.MouseButton1)
	MouseButton2      = MouseButton(glfw.MouseButton2)
	MouseButton3      = MouseButton(glfw.MouseButton3)
	MouseButton4      = MouseButton(glfw.MouseButton4)
	MouseButton5      = MouseButton(glfw.MouseButton5)
	MouseButton6      = MouseButton(glfw.MouseButton6)
	MouseButton7      = MouseButton(glfw.MouseButton7)
	MouseButton8      = MouseButton(glfw.MouseButton8)
	MouseButtonLast   = MouseButton(glfw.MouseButtonLast)
	MouseButtonLeft   = MouseButton(glfw.MouseButtonLeft)
	MouseButtonRight  = MouseButton(glfw.MouseButtonRight)
	MouseButtonMiddle = MouseButton(glfw.MouseButtonMiddle)
)

Mouse buttons

Standard cursors

View Source
const (
	Release = Action(glfw.Release) // The key or button was released.
	Press   = Action(glfw.Press)   // The key or button was pressed.
	Repeat  = Action(glfw.Repeat)  // The key was held down until it repeated.
)
View Source
const (
	CursorMode             = InputMode(glfw.CursorMode)             // See Cursor mode values
	StickyKeysMode         = InputMode(glfw.StickyKeysMode)         // Value can be either 1 or 0
	StickyMouseButtonsMode = InputMode(glfw.StickyMouseButtonsMode) // Value can be either 1 or 0
)

Input modes

View Source
const (
	CursorNormal   = glfw.CursorNormal
	CursorHidden   = glfw.CursorHidden
	CursorDisabled = glfw.CursorDisabled
)

Cursor mode values

View Source
const (
	OnWindowPos  = "win.OnWindowPos"
	OnWindowSize = "win.OnWindowSize"
	OnKeyUp      = "win.OnKeyUp"
	OnKeyDown    = "win.OnKeyDown"
	OnKeyRepeat  = "win.OnKeyRepeat"
	OnChar       = "win.OnChar"
	OnCursor     = "win.OnCursor"
	OnMouseUp    = "win.OnMouseUp"
	OnMouseDown  = "win.OnMouseDown"
	OnScroll     = "win.OnScroll"
	OnFrame      = "win.OnFrame"
)

Window event names using for dispatch and subscribe

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int

Action corresponds to a key or button action.

type CharEvent

type CharEvent struct {
	W    IWindow
	Char rune
	Mods ModifierKey
}

Char pressed in window

type CursorEvent

type CursorEvent struct {
	W    IWindow
	Xpos float32
	Ypos float32
}

Cursor position changed

type GLFW

type GLFW struct {
	core.Dispatcher
	// contains filtered or unexported fields
}

func (*GLFW) Destroy

func (w *GLFW) Destroy()

func (*GLFW) GetPos

func (w *GLFW) GetPos() (xpos, ypos int)

func (*GLFW) GetScreenResolution

func (w *GLFW) GetScreenResolution(p interface{}) (width, height int)

GetScreenResolution returns the resolution of the primary screen in pixels. The parameter is currently ignored

func (*GLFW) GetSize

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

func (*GLFW) GetTime

func (w *GLFW) GetTime() float64

func (*GLFW) MakeContextCurrent

func (w *GLFW) MakeContextCurrent()

func (*GLFW) PollEvents

func (w *GLFW) PollEvents()

func (*GLFW) SetPos

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

func (*GLFW) SetShouldClose

func (w *GLFW) SetShouldClose(v bool)

func (*GLFW) SetSize

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

func (*GLFW) SetStandardCursor

func (w *GLFW) SetStandardCursor(cursor StandardCursor)

func (*GLFW) SetTitle

func (w *GLFW) SetTitle(title string)

func (*GLFW) ShouldClose

func (w *GLFW) ShouldClose() bool

func (*GLFW) SwapBuffers

func (w *GLFW) SwapBuffers()

func (*GLFW) SwapInterval

func (w *GLFW) SwapInterval(interval int)

type IWindow

type IWindow interface {
	core.IDispatcher
	GetScreenResolution(interface{}) (width, height int)
	SwapInterval(interval int)
	MakeContextCurrent()
	GetSize() (width int, height int)
	SetSize(width int, height int)
	GetPos() (xpos, ypos int)
	SetPos(xpos, ypos int)
	SetTitle(title string)
	SetStandardCursor(cursor StandardCursor)
	SwapBuffers()
	ShouldClose() bool
	SetShouldClose(bool)
	Destroy()
	PollEvents()
	GetTime() float64
}

Interface for all window managers

func New

func New(wtype string, width, height int, title string, full bool) (IWindow, error)

New creates and returns a new window of the specified type, width, height and title. If full is true, the window will be opened in full screen and the width and height parameters will be ignored. Currently only "glfw" type is supported.

type InputMode

type InputMode int

InputMode corresponds to an input mode.

type Key

type Key int

Key corresponds to a keyboard key.

type KeyEvent

type KeyEvent struct {
	W        IWindow
	Keycode  Key
	Scancode int
	Action   Action
	Mods     ModifierKey
}

Key pressed in window

type ModifierKey

type ModifierKey int

ModifierKey corresponds to a modifier key.

type MouseButton

type MouseButton int

MouseButton corresponds to a mouse button.

type MouseEvent

type MouseEvent struct {
	W      IWindow
	Xpos   float32
	Ypos   float32
	Button MouseButton
	Action Action
	Mods   ModifierKey
}

Mouse button event

type PosEvent

type PosEvent struct {
	W    IWindow
	Xpos int
	Ypos int
}

Window position changed event

type ScrollEvent

type ScrollEvent struct {
	W       IWindow
	Xoffset float32
	Yoffset float32
}

Scroll event

type SizeEvent

type SizeEvent struct {
	W      IWindow
	Width  int
	Height int
}

Window size changed

type StandardCursor

type StandardCursor int

StandardCursor corresponds to a standard cursor icon.

Jump to

Keyboard shortcuts

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