func Init() error { ret := C.TTF_Init() if ret == 0 { return nil } return sdl.GetError() }
func Init(flags InitFlags) error { c_flags := C.int(flags) ret := C.IMG_Init(c_flags) if ret == 0 { return sdl.GetError() } return nil }
func Load(file string) (sdl.Surface, error) { c_file := C.CString(file) defer C.free(unsafe.Pointer(c_file)) ret := C.IMG_Load(c_file) if ret == nil { return sdl.Surface{}, sdl.GetError() } return sdl.Surface{unsafe.Pointer(ret)}, nil }
func OpenFont(file string, ptsize int) (Font, error) { c_file := C.CString(file) defer C.free(unsafe.Pointer(c_file)) c_ptsize := C.int(ptsize) ret := C.TTF_OpenFont(c_file, c_ptsize) if ret == nil { return Font{}, sdl.GetError() } return Font{unsafe.Pointer(ret)}, nil }
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 } /*
func (this Font) RenderTextBlended(text string, fg sdl.Color) (sdl.Surface, error) { c_font := (*C.TTF_Font)(this.Ptr) c_text := C.CString(text) defer C.free(unsafe.Pointer(c_text)) c_fg := *(*C.SDL_Color)(unsafe.Pointer(&fg)) ret := C.TTF_RenderUTF8_Blended(c_font, c_text, c_fg) if ret == nil { return sdl.Surface{}, sdl.GetError() } return sdl.Surface{unsafe.Pointer(ret)}, nil }