touch

package
v0.0.0-...-7296e18 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

The touch Pacakge handles touch events in the gl context To capture events as they happen you can use the callbacks OnTouchPress, OnTouchRelease, and OnTouchMove. Define them by calling touch.OnTouchPress = func(x, y, dx, dy, pressure float32){}.

Index

Constants

This section is empty.

Variables

View Source
var (
	// OnTouchPress is a callback that will be called when the press starts.
	OnTouchPress touchCB
	// OnTouchPress is a callback that will be called when the press ends.
	OnTouchRelease touchCB
	// OnTouchPress is a callback that will be called when the press moves position.
	OnTouchMove touchCB
)

Functions

func Delegate

func Delegate(event *sdl.TouchFingerEvent)

Delegate is used by amore/event to pass events to the touch package. It may also be useful to stub or fake events

func GetPosition

func GetPosition(id int32) (float32, float32)

GetPosition will return the x, y coordinates of the touch with the provied id This may cause a panic if the id does not exist. Safer to use GetPosition on a given touch.

func GetPressure

func GetPressure(id int32) float32

GetPressure will return the pressure for the touch with the given id. This may cause a panic if the id does not exist. Safer to use GetPressure on a given touch.

Types

type Touch

type Touch struct {
	ID int64
	*sdl.TouchFingerEvent
}

func GetTouches

func GetTouches() []Touch

GetTouches return a slice of all the current touches

func (*Touch) GetPosition

func (touch *Touch) GetPosition() (float32, float32)

GetPosition will return the x, y coordinates of the touch

func (*Touch) GetPressure

func (touch *Touch) GetPressure() float32

GetPressure will return the pressure for the touch

Jump to

Keyboard shortcuts

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