當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.TTF_RenderText_Blended函數代碼示例

本文整理匯總了Golang中C.TTF_RenderText_Blended函數的典型用法代碼示例。如果您正苦於以下問題:Golang TTF_RenderText_Blended函數的具體用法?Golang TTF_RenderText_Blended怎麽用?Golang TTF_RenderText_Blended使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了TTF_RenderText_Blended函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: RenderText_Blended

func (f *Font) RenderText_Blended(_text string, color Color) *Surface {
	ccolor := (*C.SDL_Color)(cast(&color))
	ctext := C.CString(_text)
	defer C.free(unsafe.Pointer(ctext))
	sf := C.TTF_RenderText_Blended(f.Get(), ctext, *ccolor)
	return (*Surface)(cast(sf))
}
開發者ID:henkman,項目名稱:Go2D,代碼行數:7,代碼來源:ttf.go

示例2: RenderText_Blended

func (f *Font) RenderText_Blended(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_Blended(f.f, _text, _c)))
	return surface
}
開發者ID:JalfResi,項目名稱:go-sdl2,代碼行數:7,代碼來源:sdl_ttf.go

示例3: RenderText_Blended

// Renders Latin-1 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 RenderText_Blended(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_RenderText_Blended(font.cfont, ctext, ccol)
	C.free(unsafe.Pointer(ctext))
	return (*sdl.Surface)(unsafe.Pointer(surface))
}
開發者ID:jgastal,項目名稱:Go-SDL,代碼行數:10,代碼來源:ttf.go

示例4: WriteTo

func (me *Font) WriteTo(text string, t *Image, c Color) bool {
	sur := C.TTF_RenderText_Blended(me.font, C.CString(text), c.toSDL_Color())

	runMainOp(func() {
		t.surface = C.SDL_CreateTextureFromSurface(renderer, sur)
	})

	var w, h C.int
	C.SDL_QueryTexture(t.surface, nil, nil, &w, &h)
	t.Width = int(w)
	t.Height = int(h)
	return t.surface != nil
}
開發者ID:gtalent,項目名稱:starfish,代碼行數:13,代碼來源:sdl.go

示例5: RenderText_Blended

// Renders Latin-1 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 RenderText_Blended(font *Font, text string, color sdl.Color) *sdl.Surface {
	sdl.GlobalMutex.Lock() // Because 'C.TTF_Render*' uses 'C.SDL_CreateRGBSurface'
	font.mutex.Lock()      // Use a write lock, because 'C.TTF_Render*' may update font's internal caches

	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_RenderText_Blended(font.cfont, ctext, ccol)
	C.free(unsafe.Pointer(ctext))

	font.mutex.Unlock()
	sdl.GlobalMutex.Unlock()

	return wrap(surface)
}
開發者ID:Zwobot,項目名稱:Go-SDL,代碼行數:17,代碼來源:ttf.go

示例6: Write

//Loads text into the Text object passed in.
//Returns true if successful, false otherwise.
func (me *Font) Write(text string, t *Text) bool {
	t.color = me.color
	t.text = C.TTF_RenderText_Blended(me.font, C.CString(text), me.color.toSDL_Color())
	return t.text != nil
}
開發者ID:griffy,項目名稱:starfish,代碼行數:7,代碼來源:font.go


注:本文中的C.TTF_RenderText_Blended函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。