Esempio n. 1
0
func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) int {
	_r := C.Uint8(r)
	_g := C.Uint8(g)
	_b := C.Uint8(b)
	_a := C.Uint8(a)
	return int(C.SDL_SetRenderDrawColor(renderer.cptr(), _r, _g, _b, _a))
}
Esempio n. 2
0
func (r *Renderer) SetDrawColor(c Color) {
	GlobalMutex.Lock()
	defer GlobalMutex.Unlock()

	C.SDL_SetRenderDrawColor(r.cRenderer, C.Uint8(c.R),
		C.Uint8(c.G), C.Uint8(c.B), C.Uint8(c.Alpha))
}
Esempio n. 3
0
func (r *Renderer) SetDrawColor(red, g, b, a uint8) error {
	if C.SDL_SetRenderDrawColor(r.c, C.Uint8(red), C.Uint8(g), C.Uint8(b), C.Uint8(a)) != 0 {
		return getError()
	}

	return nil
}
Esempio n. 4
0
func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) int {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_r := (C.Uint8)(r)
	_g := (C.Uint8)(g)
	_b := (C.Uint8)(b)
	_a := (C.Uint8)(a)
	return (int)(C.SDL_SetRenderDrawColor(_renderer, _r, _g, _b, _a))
}
Esempio n. 5
0
func FillRect(x, y, w, h int, c Color) {
	var rect C.SDL_Rect
	rect.x = C.int(x)
	rect.y = C.int(y)
	rect.w = C.int(w)
	rect.h = C.int(h)
	C.SDL_SetRenderDrawColor(renderer, C.Uint8(c.Red), C.Uint8(c.Green), C.Uint8(c.Blue), C.Uint8(c.Alpha))
	C.SDL_RenderFillRect(renderer, &rect)
}
Esempio n. 6
0
// Custom variant of SetDrawColor
func (renderer *Renderer) SetDrawColorArray(bs ...uint8) error {
	_bs := []C.Uint8{0, 0, 0, 255}
	for i := 0; i < len(_bs) && i < len(bs); i++ {
		_bs[i] = C.Uint8(bs[i])
	}
	_ret := C.SDL_SetRenderDrawColor(renderer.cptr(), _bs[0], _bs[1], _bs[2], _bs[3])
	if _ret < 0 {
		return GetError()
	}
	return nil
}
Esempio n. 7
0
// Renderer (https://wiki.libsdl.org/SDL_SetRenderDrawColor)
func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) error {
	_r := C.Uint8(r)
	_g := C.Uint8(g)
	_b := C.Uint8(b)
	_a := C.Uint8(a)
	_ret := C.SDL_SetRenderDrawColor(renderer.cptr(), _r, _g, _b, _a)
	if _ret < 0 {
		return GetError()
	}
	return nil
}
Esempio n. 8
0
File: canvas.go Progetto: velour/ui
// SetColor sets the color used for drawing operations (DrawPoints, DrawLines, DrawRects, FillRects, and Clear).
func (c Canvas) SetColor(col color.Color) {
	r, g, b, a := col.RGBA()
	f := 255.0 / 0xFFFF
	r8 := C.Uint8(float64(r) * f)
	g8 := C.Uint8(float64(g) * f)
	b8 := C.Uint8(float64(b) * f)
	a8 := C.Uint8(float64(a) * f)
	if C.SDL_SetRenderDrawColor(c.win.rend, r8, g8, b8, a8) < 0 {
		panic(sdlError())
	}
}
Esempio n. 9
0
func SetRenderDrawColor(_renderer *Renderer, _r uint8, _g uint8, _b uint8, _a uint8) {
	C.SDL_SetRenderDrawColor(_renderer.Get(), C.Uint8(_r), C.Uint8(_g), C.Uint8(_b), C.Uint8(_a))
}
Esempio n. 10
0
func (r *Renderer) SetDrawColor(c Color) {
	C.SDL_SetRenderDrawColor(r.cRenderer, C.Uint8(c.R),
		C.Uint8(c.G), C.Uint8(c.B), C.Uint8(c.A))
}
Esempio n. 11
0
func SetColor(c Color) {
	C.SDL_SetRenderDrawColor(renderer, C.Uint8(c.R), C.Uint8(c.G), C.Uint8(c.B), C.Uint8(255))
}