예제 #1
0
func LoadBMP(_file string) *Surface {
	cfile := C.CString(_file)
	defer C.free(unsafe.Pointer(cfile))
	cparams := C.CString("rb")
	defer C.free(unsafe.Pointer(cparams))
	return (*Surface)(C.SDL_LoadBMP_RW(C.SDL_RWFromFile(cfile, cparams), C.int(1)))
}
예제 #2
0
파일: surface.go 프로젝트: emlai/go-sdl2
// LoadBMP_RW (https://wiki.libsdl.org/SDL_LoadBMP_RW)
func LoadBMP_RW(src *RWops, freeSrc int) (*Surface, error) {
	surface := (*Surface)(unsafe.Pointer(C.SDL_LoadBMP_RW(src.cptr(), C.int(freeSrc))))
	if surface == nil {
		return nil, GetError()
	}
	return surface, nil
}
예제 #3
0
파일: surface.go 프로젝트: willemvds/sdl
func LoadBMP_RW(rw *RWops, free bool) (*Surface, error) {
	var cfree C.int
	if free {
		cfree = 1
	}

	s := C.SDL_LoadBMP_RW(rw.c, cfree)
	if s == nil {
		return nil, getError()
	}

	return (*Surface)(unsafe.Pointer(s)), nil
}
예제 #4
0
파일: surface.go 프로젝트: JalfResi/go-sdl2
func LoadBMP_RW(src *RWops, freeSrc int) *Surface {
	_surface := C.SDL_LoadBMP_RW(src.cptr(), C.int(freeSrc))
	return (*Surface)(unsafe.Pointer(_surface))
}
예제 #5
0
func LoadBMP_RW(src *RWops, freesrc int) *Surface {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(freesrc)
	_surface := C.SDL_LoadBMP_RW(_src, _freesrc)
	return (*Surface)(unsafe.Pointer(_surface))
}