event

package
v1.10.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package event is a package that models events that occur during the execution of a program.

This package is still experimental and there is no guarantee for backward compatibility so far.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
}

Event is an interface that custom events should implement. It is empty for now because there are no general methods required of events yet.

type GamepadAttach

type GamepadAttach struct {
	// ID represents which gamepad caused the event.
	ID int
	// Axes represents the amount of axes the gamepad has.
	Axes int
	// Buttons represents the amount of buttons the gamepad has.
	Buttons int
}

GamepadAttach happens when a new gamepad is attached.

type GamepadAxis

type GamepadAxis struct {
	// ID represents which gamepad caused the event.
	ID int
	// Axis is the axis of the game pad that changed position.
	Axis int
	// Position is the psoition of the axis after the change.
	// It varies between -1.0 and 1.0.
	Position float32
}

GamepadAxis is for event where an axis on a gamepad changes.

type GamepadButtonDown

type GamepadButtonDown struct {
	// ID represents which gamepad caused the event.
	ID int
	// Button is the button that was pressed on the game pad.
	Button int
	// Pressure is the pressure that is applied to the gamepad button.
	// It varies between 0.0 for not pressed, and 1.0 for completely pressed.
	Pressure float32
}

GamepadButtonDown is a gamepad button press event.

type GamepadButtonUp

type GamepadButtonUp GamepadButtonDown

GamepadButtonDown is a gamepad button release event. The data is identical to a GamePadButtonDown event.

type GamepadDetach

type GamepadDetach struct {
	// ID represents which gamepad caused the event.
	ID int
}

GamepadDetach happens when a gamepad is detached.

type Key

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

type KeyboardKeyCharacter

type KeyboardKeyCharacter struct {
	// Key is the key code of the key typed.
	Key Key
	// Modifier is the logical-or value of the modifiers pressed together with the key.
	Modifier Modifier
	// Character is the character that was typed.
	Character rune
}

KeyboardKeyCharacter is an event that occurs when a character is actually typed on the keyboard. This may be provided by an input method.

type KeyboardKeyDown

type KeyboardKeyDown struct {
	// Key is the key code of the key pressed or released.
	Key Key
	// Modifier is the logical-or value of the modifiers pressed together with the key.
	Modifier Modifier
}

KeyboardKeyDown is an event that occurs when a key is pressed on the keyboard.

type KeyboardKeyUp

type KeyboardKeyUp KeyboardKeyDown

KeyboardKeyUp is an event that occurs when a key is released on the keyboard. The data is the same as for a KeyboardKeyDown event.

type Modifier

type Modifier int

Modifier is a bit set of modifier keys on a keyboard.

const (
	ModifierShift    Modifier = Modifier(driver.ModifierShift)
	ModifierControl  Modifier = Modifier(driver.ModifierControl)
	ModifierAlt      Modifier = Modifier(driver.ModifierAlt)
	ModifierCapsLock Modifier = Modifier(driver.ModifierCapsLock)
	ModifierNumLock  Modifier = Modifier(driver.ModifierNumLock)
)

type MouseButtonDown

type MouseButtonDown struct {
	// X is the X position of the mouse pointer.
	// This value is expressed in device independent pixels.
	X float32
	// Y is the Y position of the mouse pointer.
	// This value is expressed in device independent pixels.
	Y float32
	// Button is the button on the mouse that was pressed.
	// TODO: this should change later from an int to an enumeration type.
	Button int
	// Pressure is the pressure applied on the mouse button.
	// It varies between 0.0 for not pressed, and 1.0 for completely pressed.
	Pressure float32
}

MouseButtonDown is a mouse button press event.

type MouseButtonUp

type MouseButtonUp MouseButtonDown

MouseButtonDown is a mouse button Release event. The data is identical to a MouseButtonDown event.

type MouseEnter

type MouseEnter struct {
	// X is the X position of the mouse pointer.
	// This value is expressed in device independent pixels.
	X float32
	// Y is the Y position of the mouse pointer.
	// This value is expressed in device independent pixels.
	Y float32
}

MouseEnter occurs when the mouse enters the view window.

type MouseLeave

type MouseLeave MouseEnter

MouseLeave occurs when the mouse leaves the view window. The data is identical to MouseEnter.

type MouseMove

type MouseMove struct {
	// X is the X position of the mouse pointer.
	// This value is expressed in device independent pixels.
	X float32
	// Y is the Y position of the mouse pointer.
	// This value is expressed in device independent pixels.
	Y float32
	// DeltaX is the change in X since the last MouseMove event.
	// This value is expressed in device independent pixels.
	DeltaX float32
	// DeltaY is the change in Y since the last MouseMove event.
	// This value is expressed in device independent pixels.
	DeltaY float32
}

MouseMove is a mouse movement event.

type MouseWheel

type MouseWheel struct {
	// X is the X position of the mouse wheel.
	// This value is expressed in arbitrary units.
	// It increases when the mouse wheel is scrolled downwards,
	// and decreases when the mouse is scrolled upwards.
	X float32
	// Y is the Y position of the mouse wheel.
	// This value is expressed in arbitrary units.
	// It increases when the mouse wheel is scrolled to the right,
	// and decreases when the mouse is scrolled to the left.
	Y float32
	// DeltaX is the change in X since the last MouseWheel event.
	// This value is expressed in arbitrary units.
	// It is positive when the mouse wheel is scrolled downwards,
	// and negative when the mouse is scrolled upwards.
	DeltaX float32
	// DeltaY is the change in Y since the last MouseWheel event.
	// This value is expressed in arbitrary units.
	// It is positive when the mouse wheel is scrolled to the right,
	// and negative when the mouse is scrolled to the left.
	DeltaY float32
}

MouseWheel is a mouse wheel event.

type TouchBegin

type TouchBegin struct {
	// ID identifies the touch that caused the touch event.
	ID int
	// X is the X position of the touch.
	// This value is expressed in device independent pixels.
	X float32
	// Y is the Y position of the touch.
	// This value is expressed in device independent pixels.
	Y float32
	// Pressure is the pressure applied to the touch.
	// It varies between 0.0 for not pressed, and 1.0 for completely pressed.
	Pressure float32
	// Primary represents whether the touch event is the primary touch or not.
	// If it is true, then it is a primary touch.
	// Otherwise it is false.
	Primary bool
}

TouchBegin occurs when a touch begins.

type TouchCancel

type TouchCancel struct {
	// ID identifies the touch that caused the touch event.
	ID int
}

TouchCancel occurs when a touch is canceled. This can happen in various situations, depending on the underlying platform, for example when the aplication loses focus.

type TouchEnd

type TouchEnd TouchMove

TouchEnd occurs when a touch ends. The data is the same as for a TouchMove event.

type TouchMove

type TouchMove struct {
	// ID identifies the touch that caused the touch event.
	ID int
	// X is the X position of the touch.
	// This value is expressed in device independent pixels.
	X float32
	// Y is the Y position of the touch.
	// This value is expressed in device independent pixels.
	Y float32
	// DeltaX is the change in X since last touch event.
	// This value is expressed in device independent pixels.
	DeltaX float32
	// Deltay is the change in Y since last touch event.
	// This value is expressed in device independent pixels.
	DeltaY float32
	// Pressure of applied touch.
	// It varies between 0.0 for not pressed, and 1.0 for completely pressed.
	Pressure float32
	// Primary represents whether the touch event is the primary touch or not.
	// If it is true, then it is a primary touch.
	// If it is false then it is not.
	Primary bool
}

TouchMove occurs when a touch moved, or in other words, is dragged.

type ViewSize

type ViewSize struct {
	// Width is the width of the view.
	// This value is expressed in device independent pixels.
	Width int
	// Height is the height of the view.
	// This value is expressed in device independent pixels.
	Height int
}

ViewSize occurs when the size of the application's view port changes.

type ViewUpdate

type ViewUpdate struct {
}

ViewUpdate occurs when the application is ready to update the next frame on the view port.

Jump to

Keyboard shortcuts

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