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


Golang C.TTF_OpenFontIndex函数代码示例

本文整理汇总了Golang中C.TTF_OpenFontIndex函数的典型用法代码示例。如果您正苦于以下问题:Golang TTF_OpenFontIndex函数的具体用法?Golang TTF_OpenFontIndex怎么用?Golang TTF_OpenFontIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TTF_OpenFontIndex函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: OpenFontIndex

func OpenFontIndex(file string, ptsize int, index int64) (*Font, error) {
	cfile := C.CString(file)
	defer C.free(unsafe.Pointer(cfile))
	font := C.TTF_OpenFontIndex(cfile, C.int(ptsize), C.long(index))
	if font == nil {
		return nil, getError()
	}
	return &Font{c: font}, nil
}
开发者ID:willemvds,项目名称:sdl,代码行数:9,代码来源:ttf.go

示例2: OpenFontIndex

func OpenFontIndex(file string, ptsize int, index int64) (Font, error) {
	c_file := C.CString(file)
	defer C.free(unsafe.Pointer(c_file))
	c_ptsize := C.int(ptsize)
	c_index := C.long(index)
	ret := C.TTF_OpenFontIndex(c_file, c_ptsize, c_index)
	if ret == nil {
		return Font{}, sdl.GetError()
	}
	return Font{unsafe.Pointer(ret)}, nil
} /*
开发者ID:badgerodon,项目名称:go,代码行数:11,代码来源:ttf.go

示例3: OpenFontIndex

func OpenFontIndex(file string, size int, index int) (*Font, error) {
	_file := (C.CString)(file)
	_size := (C.int)(size)
	_index := (C.long)(index)
	f := (*C.TTF_Font)(C.TTF_OpenFontIndex(_file, _size, _index))
	C.free(unsafe.Pointer(_file))
	if f == nil {
		return nil, GetError()
	}
	return &Font{f}, nil
}
开发者ID:hybridgroup,项目名称:go-sdl2,代码行数:11,代码来源:sdl_ttf.go

示例4: OpenFontIndex

// Loads a font from a file containing multiple font faces at the specified
// point size.
func OpenFontIndex(file string, ptsize, index int) *Font {
	cfile := C.CString(file)
	cfont := C.TTF_OpenFontIndex(cfile, C.int(ptsize), C.long(index))
	C.free(unsafe.Pointer(cfile))

	if cfont == nil {
		return nil
	}

	return &Font{cfont}
}
开发者ID:jgastal,项目名称:Go-SDL,代码行数:13,代码来源:ttf.go

示例5: OpenFontIndex

// Loads a font from a file containing multiple font faces at the specified
// point size.
func OpenFontIndex(file string, ptsize, index int) (*Font, error) {
	sdl.GlobalMutex.Lock()

	cfile := C.CString(file)
	cfont := C.TTF_OpenFontIndex(cfile, C.int(ptsize), C.long(index))
	C.free(unsafe.Pointer(cfile))

	sdl.GlobalMutex.Unlock()

	if cfont == nil {
		return nil, errors.New("Unable to load font")
	}

	return &Font{cfont: cfont}, nil
}
开发者ID:jonhanks,项目名称:Go-SDL,代码行数:17,代码来源:ttf.go

示例6: TTFOpenFontIndex

func TTFOpenFontIndex(file string, ptsize int, index int32) *C.TTF_Font {
	cfile := cstr(file)
	defer cfile.free()
	return C.TTF_OpenFontIndex(cfile, C.int(ptsize), C.long(index))
}
开发者ID:beoran,项目名称:fungo,代码行数:5,代码来源:ttf.go


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