Example #1
0
// Texture (https://wiki.libsdl.org/SDL_SetTextureAlphaMod)
func (texture *Texture) SetAlphaMod(alpha uint8) error {
	_ret := C.SDL_SetTextureAlphaMod(texture.cptr(), C.Uint8(alpha))
	if _ret < 0 {
		return GetError()
	}
	return nil
}
Example #2
0
func (t *Texture) SetAlphaMod(a uint8) error {
	if C.SDL_SetTextureAlphaMod(t.c, C.Uint8(a)) != 0 {
		return getError()
	}

	return nil
}
Example #3
0
//Draws the image at the given coordinates.
func DrawImage(img *Image, destX, destY, srcX, srcY, srcW, srcH int) {
	var src, dest C.SDL_Rect
	dest.x = C.int(destX)
	dest.y = C.int(destY)
	dest.w = C.int(img.Width)
	dest.h = C.int(img.Height)

	src.x = C.int(srcX)
	src.y = C.int(srcY)
	src.w = C.int(srcW)
	src.h = C.int(srcH)
	C.SDL_SetTextureAlphaMod(img.surface, 255)
	C.SDL_RenderCopy(renderer, img.surface, &src, &dest)
}
Example #4
0
func (t *Texture) SetAlpha(_alpha uint8) {
	C.SDL_SetTextureAlphaMod(t.Get(), C.Uint8(_alpha))
}
Example #5
0
func (t *Texture) SetAlphaMod(alpha uint8) bool {
	ret := C.SDL_SetTextureAlphaMod(t.cTexture, C.Uint8(alpha))
	return int(ret) == 0
}
Example #6
0
func (texture *Texture) SetAlphaMod(alpha uint8) int {
	_texture := (*C.SDL_Texture)(unsafe.Pointer(texture))
	_alpha := (C.Uint8)(alpha)
	return (int)(C.SDL_SetTextureAlphaMod(_texture, _alpha))
}
Example #7
0
func (texture *Texture) SetAlphaMod(alpha uint8) int {
	return int(C.SDL_SetTextureAlphaMod(texture.cptr(), C.Uint8(alpha)))
}