当前位置: 首页>>代码示例>>Golang>>正文


Golang C.Uint8函数代码示例

本文整理汇总了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
}
开发者ID:willemvds,项目名称:sdl,代码行数:7,代码来源:render.go

示例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))
}
开发者ID:jgastal,项目名称:Go-SDL,代码行数:9,代码来源:ttf.go

示例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
}
开发者ID:JalfResi,项目名称:go-sdl2,代码行数:7,代码来源:sdl_ttf.go

示例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))
}
开发者ID:JalfResi,项目名称:go-sdl2,代码行数:7,代码来源:render.go

示例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))
}
开发者ID:kalaspuffar,项目名称:Go-SDL2,代码行数:7,代码来源:sdl.go

示例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)
}
开发者ID:krig,项目名称:Go-SDL2,代码行数:10,代码来源:ttf.go

示例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
}
开发者ID:willemvds,项目名称:sdl,代码行数:7,代码来源:surface.go

示例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
}
开发者ID:willemvds,项目名称:sdl,代码行数:7,代码来源:render.go

示例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)
}
开发者ID:badgerodon,项目名称:go,代码行数:8,代码来源:video.go

示例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),
	))
}
开发者ID:DeedleFake,项目名称:sdl,代码行数:9,代码来源:pixels.go

示例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)
}
开发者ID:gtalent,项目名称:starfish,代码行数:9,代码来源:sdl.go

示例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
}
开发者ID:willemvds,项目名称:sdl,代码行数:9,代码来源:ttf.go

示例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)
}
开发者ID:jbondeson,项目名称:Go-SDL2,代码行数:10,代码来源:audio.go

示例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
}
开发者ID:veandco,项目名称:go-sdl2,代码行数:9,代码来源:sdl_gfx.go

示例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
}
开发者ID:emlai,项目名称:go-sdl2,代码行数:11,代码来源:render.go


注:本文中的C.Uint8函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。