本文整理汇总了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
}
示例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
} /*
示例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
}
示例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}
}
示例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
}
示例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))
}