touch

touch.nim

Include file for SDL touch event handling.

Types

TouchID* = int64
FingerID* = int64
TouchDeviceType* {...}{.size: sizeof(cint).} = enum
  TOUCH_DEVICE_INVALID = -1, TOUCH_DEVICE_DIRECT, ## touch screen with window-relative coordinates
  TOUCH_DEVICE_INDIRECT_ABSOLUTE, ## trackpad with absolute device coordinates
  TOUCH_DEVICE_INDIRECT_RELATIVE ## trackpad with screen cursor-relative coordinates
Finger* = object
  id*: FingerID
  x*: cfloat
  y*: cfloat
  pressure*: cfloat

Consts

TOUCH_MOUSEID* = cast[uint32](-1'i32)
Used as the device ID for mouse events simulated with touch input
MOUSE_TOUCHID*: int64 = -1
Used as the sdl.TouchID for touch events simulated with mouse input

Procs

proc getNumTouchDevices*(): cint {...}{.cdecl, importc: "SDL_GetNumTouchDevices",
                                   dynlib: SDL2_LIB.}
Get the number of registered touch devices.
proc getTouchDevice*(index: cint): TouchID {...}{.cdecl,
    importc: "SDL_GetTouchDevice", dynlib: SDL2_LIB.}
Get the touch ID with the given index, or 0 if the index is invalid.
proc getTouchDeviceType*(touchID: TouchID): TouchDeviceType {...}{.cdecl,
    importc: "SDL_GetTouchDeviceType", dynlib: SDL2_LIB.}
Get the type of the given touch device.
proc getNumTouchFingers*(touchID: TouchID): cint {...}{.cdecl,
    importc: "SDL_GetNumTouchFingers", dynlib: SDL2_LIB.}
Get the number of active fingers for a given touch device.
proc getTouchFinger*(touchID: TouchID; index: cint): ptr Finger {...}{.cdecl,
    importc: "SDL_GetTouchFinger", dynlib: SDL2_LIB.}
Get the finger object of the given touch, with the given index.