func JoystickGetGUIDString(guid JoystickGUID, pszGUID string, cbGUID int) { _guid := (C.SDL_JoystickGUID)(guid) _pszGUID := (C.CString)(pszGUID) _cbGUID := (C.int)(cbGUID) defer C.SDL_free(unsafe.Pointer(_pszGUID)) C.SDL_JoystickGetGUIDString(_guid, _pszGUID, _cbGUID) }
// GetClipboardText (https://wiki.libsdl.org/SDL_GetClipboardText) func GetClipboardText() (string, error) { text := C.SDL_GetClipboardText() if text == nil { return "", GetError() } defer C.SDL_free(unsafe.Pointer(text)) _text := C.GoString(text) return _text, nil }
func GetPrefPath(org, app string) string { _org := C.CString(org) _app := C.CString(app) defer C.free(unsafe.Pointer(_org)) defer C.free(unsafe.Pointer(_app)) _val := C._SDL_GetPrefPath(_org, _app) defer C.SDL_free(unsafe.Pointer(_val)) return C.GoString(_val) }
// GetClipboardText returns text from the clipboard. // // Note: A Window must be created before calling this function. func GetClipboardText() (text string, err error) { s := C.SDL_GetClipboardText() if s == nil { return "", getError() } defer C.SDL_free(unsafe.Pointer(s)) text = C.GoString(s) return text, nil }
// UpdateRects copies a number of rectangles on the window surface to the // screen. // // Note: A Surface must be associated with the window before calling this // function. func (win *Window) UpdateRects(rects []image.Rectangle) (err error) { cRects := C.makeRectArray(C.int(len(rects))) defer C.SDL_free(unsafe.Pointer(cRects)) for index, rect := range rects { cRect := cRect(rect) C.setArrayRect(cRects, cRect, C.int(index)) } if C.SDL_UpdateWindowSurfaceRects(win.cWin, cRects, C.int(len(rects))) != 0 { return getError() } return nil }
func GameControllerAddMapping(mappingString string) int { _mappingString := (C.CString)(mappingString) defer C.SDL_free(unsafe.Pointer(_mappingString)) return (int)(C.SDL_GameControllerAddMapping(_mappingString)) }
func GameControllerGetButtonFromString(pchString string) GameControllerButton { _pchString := (C.CString)(pchString) defer C.SDL_free(unsafe.Pointer(_pchString)) return (GameControllerButton)(C.SDL_GameControllerGetButtonFromString(_pchString)) }
func GameControllerGetAxisFromString(pchString string) GameControllerAxis { _pchString := (C.CString)(pchString) defer C.SDL_free(unsafe.Pointer(_pchString)) return (GameControllerAxis)(C.SDL_GameControllerGetAxisFromString(_pchString)) }
func JoystickGetGUIDFromString(pchGUID string) JoystickGUID { _pchGUID := (C.CString)(pchGUID) defer C.SDL_free(unsafe.Pointer(_pchGUID)) return (JoystickGUID)(C.SDL_JoystickGetGUIDFromString(_pchGUID)) }
func LoadObject(sofile string) unsafe.Pointer { _sofile := (C.CString)(sofile) defer C.SDL_free(unsafe.Pointer(_sofile)) return (unsafe.Pointer)(C.SDL_LoadObject(_sofile)) }
func LoadFunction(handle unsafe.Pointer, name string) unsafe.Pointer { _name := (C.CString)(name) defer C.SDL_free(unsafe.Pointer(_name)) return (unsafe.Pointer)(C.SDL_LoadFunction(handle, _name)) }
func GetBasePath() string { _val := C._SDL_GetBasePath() defer C.SDL_free(unsafe.Pointer(_val)) return C.GoString(_val) }
func SetClipboardText(text string) int { _text := (C.CString)(text) defer C.SDL_free(unsafe.Pointer(_text)) return (int)(C.SDL_SetClipboardText(_text)) }
func GetClipboardText() string { ctext := C.SDL_GetClipboardText() defer C.SDL_free(unsafe.Pointer(ctext)) return C.GoString(ctext) }
// GetClipboardText (https://wiki.libsdl.org/SDL_GetClipboardText) func GetClipboardText() string { text := C.SDL_GetClipboardText() defer C.SDL_free(unsafe.Pointer(text)) _text := C.GoString(text) return _text }