Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device provides access to a platform specific user input and display surface.
func (*Device) CreateDisplay ¶ added in v0.20.0
CreateDisplay initializes a window. Called once at initialization.
func (*Device) Dispose ¶
func (d *Device) Dispose()
Dispose releases all platform specific resources.
func (*Device) GetInput ¶ added in v0.20.0
GetInput updates the user input. Expected to be called frequently, ie: once before each game update.
func (*Device) SetResizeHandler ¶ added in v0.20.0
func (d *Device) SetResizeHandler(callback func())
SetResizeHandler registers a callback to do stuff any time the window is resized.
func (*Device) SurfaceSize ¶ added in v0.20.0
Returns the size of the surface in pixels.
type Input ¶ added in v0.20.0
type Input struct {
Mx, My int32 // Mouse location relative to top left.
Scroll int // Scroll amount: positive, negative, or Zero if no scrolling.
Focus bool // True if window has focus.
// Pressed are keys that were pressed since last request.
Pressed map[int32]bool //
// Down are keys that are currently being pressed.
// This includes keys that were just pressed and which
// are being held down. The value can be used to calculate
// how long the key has been down.
// Down keys are cleared when the key is
// released or when the windows looses focus.
Down map[int32]time.Time // time when key was pressed.
// Released are keys that were just released since last request.
// Keys are also released when the window loses focus.
Released map[int32]time.Duration // total time down.
// contains filtered or unexported fields
}
Input gathers user input and organizes it for mapping to game actions. Input data is shared with the app and the app should treat the data as read only.
Click to show internal directories.
Click to hide internal directories.