示例#1
0
文件: video.go 项目: DeedleFake/sdl
func (win *Window) SetData(name string, data interface{}) interface{} {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	pd := C.SDL_SetWindowData(win.c, cname, unsafe.Pointer(&data))
	if pd == nil {
		return nil
	}

	return *(*interface{})(pd)
}
示例#2
0
func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Pointer {
	_window := (*C.SDL_Window)(unsafe.Pointer(window))
	_name := C.CString(name)
	defer C.free(unsafe.Pointer(_name))
	return (unsafe.Pointer)(C.SDL_SetWindowData(_window, _name, userdata))
}
示例#3
0
文件: video.go 项目: flazz/go-sdl2
// Window (https://wiki.libsdl.org/SDL_SetWindowData)
func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Pointer {
	_name := C.CString(name)
	return unsafe.Pointer(C.SDL_SetWindowData(window.cptr(), _name, userdata))
}