本文整理匯總了Golang中C.Uint8函數的典型用法代碼示例。如果您正苦於以下問題:Golang Uint8函數的具體用法?Golang Uint8怎麽用?Golang Uint8使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Uint8函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SetColorMod
func (t *Texture) SetColorMod(r, g, b uint8) error {
if C.SDL_SetTextureColorMod(t.c, C.Uint8(r), C.Uint8(g), C.Uint8(b)) != 0 {
return getError()
}
return nil
}
示例2: RenderUTF8_Solid
// Renders UTF-8 text in the specified color and returns an SDL surface. Solid
// rendering is quick, although not as smooth as the other rendering types.
func RenderUTF8_Solid(font *Font, text string, color sdl.Color) *sdl.Surface {
ctext := C.CString(text)
ccol := C.SDL_Color{C.Uint8(color.R), C.Uint8(color.G), C.Uint8(color.B), C.Uint8(color.Unused)}
surface := C.TTF_RenderUTF8_Solid(font.cfont, ctext, ccol)
C.free(unsafe.Pointer(ctext))
return (*sdl.Surface)(unsafe.Pointer(surface))
}
示例3: RenderText_Solid
func (f *Font) RenderText_Solid(text string, color sdl.Color) *sdl.Surface {
_text := C.CString(text)
defer C.free(unsafe.Pointer(_text))
_c := C.SDL_Color{C.Uint8(color.R), C.Uint8(color.G), C.Uint8(color.B), C.Uint8(color.A)}
surface := (*sdl.Surface)(unsafe.Pointer(C.TTF_RenderText_Solid(f.f, _text, _c)))
return surface
}
示例4: SetDrawColor
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))
}
示例5: SetDrawColor
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))
}
示例6: RenderUTF8_Blended
// Renders UTF-8 text in the specified color and returns an SDL surface.
// Blended rendering is the slowest of the three methods, although it produces
// the best results, especially when blitted over another image.
func (font *Font) RenderUTF8_Blended(text string, color sdl.Color) *sdl.Surface {
ctext := C.CString(text)
ccol := C.SDL_Color{C.Uint8(color.R), C.Uint8(color.G), C.Uint8(color.B), C.Uint8(color.A)}
surface := C.TTF_RenderUTF8_Blended(font.cfont, ctext, ccol)
C.free(unsafe.Pointer(ctext))
return wrap(surface)
}
示例7: SetColorMod
func (s *Surface) SetColorMod(r, g, b uint8) error {
if C.SDL_SetSurfaceColorMod(s.c(), C.Uint8(r), C.Uint8(g), C.Uint8(b)) != 0 {
return getError()
}
return nil
}
示例8: SetDrawColor
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
}
示例9: MapRGB
func MapRGB(pixelFormat PixelFormat, r, g, b uint8) uint32 {
c_format := (*C.SDL_PixelFormat)(pixelFormat.Ptr)
c_r := C.Uint8(r)
c_g := C.Uint8(g)
c_b := C.Uint8(b)
ret := C.SDL_MapRGB(c_format, c_r, c_g, c_b)
return uint32(ret)
}
示例10: MapRGBA
func (p *PixelFormat) MapRGBA(r, g, b, a uint8) uint32 {
return uint32(C.SDL_MapRGBA(
p.c(),
C.Uint8(r),
C.Uint8(g),
C.Uint8(b),
C.Uint8(a),
))
}
示例11: FillRect
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)
}
示例12: RenderUTF8Solid
func (f *Font) RenderUTF8Solid(text string, fg sdl.Color) (*sdl.Surface, error) {
ctext := C.CString(text)
ccolor := C.SDL_Color{C.Uint8(fg.R), C.Uint8(fg.G), C.Uint8(fg.B), C.Uint8(255)}
s := C.TTF_RenderUTF8_Solid(f.c, ctext, ccolor)
if s == nil {
return nil, getError()
}
return (*sdl.Surface)(unsafe.Pointer(s)), nil
}
示例13: BuildAudioCVT
// returns (cvt, 0/1/-1) -- 0 means no conversion, 1 means filter is set up
func BuildAudioCVT(src_format AudioFormat, src_channels uint8, src_rate int,
dst_format AudioFormat, dst_channels uint8, dst_rate int) (*AudioCVT, int) {
var cvt C.SDL_AudioCVT
ret := C.SDL_BuildAudioCVT(&cvt,
C.SDL_AudioFormat(int(src_format)), C.Uint8(src_channels), C.int(src_rate),
C.SDL_AudioFormat(int(dst_format)), C.Uint8(dst_channels), C.int(dst_rate))
rcvt := &AudioCVT{&cvt, nil}
return rcvt, int(ret)
}
示例14: PixelRGBA
func PixelRGBA(renderer *sdl.Renderer, x, y int, r, g, b, a uint8) bool {
_x := C.Sint16(x)
_y := C.Sint16(y)
_r := C.Uint8(r)
_g := C.Uint8(g)
_b := C.Uint8(b)
_a := C.Uint8(a)
return C.pixelRGBA(renderer, _x, _y, _r, _g, _b, _a) == 0
}
示例15: SetColorMod
// Texture (https://wiki.libsdl.org/SDL_SetTextureColorMod)
func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) error {
_r := C.Uint8(r)
_g := C.Uint8(g)
_b := C.Uint8(b)
_ret := C.SDL_SetTextureColorMod(texture.cptr(), _r, _g, _b)
if _ret < 0 {
return GetError()
}
return nil
}