Example #1
0
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)
}
Example #2
0
// 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
}
Example #3
0
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)
}
Example #4
0
// 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
}
Example #5
0
File: video.go Project: salihdb/sdl
// 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
}
Example #6
0
func GameControllerAddMapping(mappingString string) int {
	_mappingString := (C.CString)(mappingString)
	defer C.SDL_free(unsafe.Pointer(_mappingString))
	return (int)(C.SDL_GameControllerAddMapping(_mappingString))
}
Example #7
0
func GameControllerGetButtonFromString(pchString string) GameControllerButton {
	_pchString := (C.CString)(pchString)
	defer C.SDL_free(unsafe.Pointer(_pchString))
	return (GameControllerButton)(C.SDL_GameControllerGetButtonFromString(_pchString))
}
Example #8
0
func GameControllerGetAxisFromString(pchString string) GameControllerAxis {
	_pchString := (C.CString)(pchString)
	defer C.SDL_free(unsafe.Pointer(_pchString))
	return (GameControllerAxis)(C.SDL_GameControllerGetAxisFromString(_pchString))
}
Example #9
0
func JoystickGetGUIDFromString(pchGUID string) JoystickGUID {
	_pchGUID := (C.CString)(pchGUID)
	defer C.SDL_free(unsafe.Pointer(_pchGUID))
	return (JoystickGUID)(C.SDL_JoystickGetGUIDFromString(_pchGUID))
}
Example #10
0
func LoadObject(sofile string) unsafe.Pointer {
	_sofile := (C.CString)(sofile)
	defer C.SDL_free(unsafe.Pointer(_sofile))
	return (unsafe.Pointer)(C.SDL_LoadObject(_sofile))
}
Example #11
0
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))
}
Example #12
0
func GetBasePath() string {
	_val := C._SDL_GetBasePath()
	defer C.SDL_free(unsafe.Pointer(_val))
	return C.GoString(_val)
}
Example #13
0
func SetClipboardText(text string) int {
	_text := (C.CString)(text)
	defer C.SDL_free(unsafe.Pointer(_text))
	return (int)(C.SDL_SetClipboardText(_text))
}
Example #14
0
func GetClipboardText() string {
	ctext := C.SDL_GetClipboardText()
	defer C.SDL_free(unsafe.Pointer(ctext))

	return C.GoString(ctext)
}
Example #15
0
// 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
}