Пример #1
0
// Texture (https://wiki.libsdl.org/SDL_SetTextureBlendMode)
func (texture *Texture) SetBlendMode(bm BlendMode) error {
	_ret := C.SDL_SetTextureBlendMode(texture.cptr(), bm.c())
	if _ret < 0 {
		return GetError()
	}
	return nil
}
Пример #2
0
func (t *Texture) SetBlendMode(mode BlendMode) error {
	if C.SDL_SetTextureBlendMode(t.c, mode.c()) != 0 {
		return getError()
	}

	return nil
}
Пример #3
0
func texFromImage(rend *C.SDL_Renderer, img *image.NRGBA) *C.SDL_Texture {
	b := img.Bounds()
	w, h := b.Dx(), b.Dy()
	fmt := C.SDL_PIXELFORMAT_ABGR8888
	acc := C.SDL_TEXTUREACCESS_STATIC
	tex := C.SDL_CreateTexture(rend, C.Uint32(fmt), C.int(acc), C.int(w), C.int(h))
	if tex == nil {
		panic(sdlError())
	}
	if C.SDL_UpdateTexture(tex, nil, unsafe.Pointer(&img.Pix[0]), C.int(img.Stride)) < 0 {
		panic(sdlError())
	}
	if C.SDL_SetTextureBlendMode(tex, C.SDL_BLENDMODE_BLEND) < 0 {
		panic(sdlError())
	}
	return tex
}
Пример #4
0
func (t *Texture) SetBlendMode(_blendmode int) {
	C.SDL_SetTextureBlendMode(t.Get(), C.SDL_BlendMode(_blendmode))
}
Пример #5
0
func (t *Texture) SetBlendMode(blendmode int) bool {
	ret := C.SDL_SetTextureBlendMode(t.cTexture, C.SDL_BlendMode(blendmode))
	return int(ret) == 0
}
Пример #6
0
func (texture *Texture) SetBlendMode(blendMode uint32) int {
	_texture := (*C.SDL_Texture)(unsafe.Pointer(texture))
	_blendMode := (C.SDL_BlendMode)(C.Uint32(blendMode))
	return (int)(C.SDL_SetTextureBlendMode(_texture, _blendMode))
}
Пример #7
0
func (texture *Texture) SetBlendMode(bm BlendMode) int {
	return int(C.SDL_SetTextureBlendMode(texture.cptr(), bm.c()))
}