code.witches.io/go/sdl2@v0.1.1/gesture.go (about) 1 package sdl 2 3 // #include <SDL2/SDL_gesture.h> 4 import "C" 5 import ( 6 "unsafe" 7 ) 8 9 type GestureID int64 10 11 func RecordGesture(touchID TouchID) bool { 12 return C.SDL_RecordGesture(C.Sint64(touchID)) == 0 13 } 14 15 func LoadDollarTemplates(touchID TouchID, src *RWOps) (int, error) { 16 n := int(C.SDL_LoadDollarTemplates(C.Sint64(touchID), (*C.struct_SDL_RWops)(unsafe.Pointer(src)))) 17 if n < 0 { 18 return 0, GetError() 19 } 20 return n, nil 21 } 22 23 func SaveAllDollarTemplates(dst *RWOps) (int, error) { 24 n := int(C.SDL_SaveAllDollarTemplates((*C.struct_SDL_RWops)(unsafe.Pointer(dst)))) 25 if n < 0 { 26 return 0, GetError() 27 } 28 return n, nil 29 } 30 31 func SaveDollarTemplate(gestureID GestureID, dst *RWOps) error { 32 if C.SDL_SaveDollarTemplate(C.Sint64(gestureID), (*C.struct_SDL_RWops)(unsafe.Pointer(dst))) != 1 { 33 return GetError() 34 } 35 return nil 36 }