X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_FTGL.lisp;h=1d78fe9bfb8eca0aa574730008826f51d2cfec3d;hb=6a3d1ffb69036e6d4f1c239fd7d52f9bfc48d50c;hp=823be34a4cc0b9025f9b6462721c1b5f0dd856c5;hpb=02026932e3ecf2ff041a8a0389cf6c077df3e49d;p=gacela.git diff --git a/gacela_FTGL.lisp b/gacela_FTGL.lisp index 823be34..1d78fe9 100644 --- a/gacela_FTGL.lisp +++ b/gacela_FTGL.lisp @@ -15,10 +15,26 @@ ;;; along with this program. If not, see . -(in-package :gacela) +(eval-when (compile load eval) + (when (not (find-package 'gacela)) (make-package 'gacela :nicknames '(gg) :use '(lisp))) + (in-package 'gacela :nicknames '(gg) :use '(lisp))) + + +(defmacro mapcconst (type c-type name) + (let ((c-header (concatenate 'string c-type " gacela_" name " (void)")) + (c-body (concatenate 'string "return " name ";")) + (c-name (concatenate 'string "gacela_" name)) + (lisp-name (intern (string-upcase name)))) + `(progn + (defcfun ,c-header 0 ,c-body) + (defentry ,lisp-name () (,type ,c-name)) + (eval-when (load) (defconstant ,lisp-name (,lisp-name)))))) (clines "#include ") +(mapcconst int "int" "ft_encoding_unicode") +(mapcconst int "int" "FTGL_RENDER_ALL") + ;;; FTGL Functions (defcfun "int gacela_ftglCreateTextureFont (char *file)" 0 "return ftglCreateTextureFont (file);") @@ -26,9 +42,17 @@ (defcfun "int gacela_ftglSetFontFaceSize (int font, int size, int res)" 0 "return ftglSetFontFaceSize (font, size, res);") -(defcfun "int gacela_ftglSetFontCharMap(int font, int encoding)" 0 - "return ftglSetFontCharMap(font, encoding);") +(defcfun "int gacela_ftglSetFontCharMap (int font, int encoding)" 0 + "return ftglSetFontCharMap (font, encoding);") + +(defcfun "void gacela_ftglRenderFont (int font, char *string, int mode)" 0 + "ftglRenderFont (font, string, mode);") + +(defcfun "void gacela_ftglDestroyFont (int font)" 0 + "ftglDestroyFont (font);") (defentry ftglCreateTextureFont (string) (int "gacela_ftglCreateTextureFont")) (defentry ftglSetFontFaceSize (int int int) (int "gacela_ftglSetFontFaceSize")) (defentry ftglSetFontCharMap (int int) (int "gacela_ftglSetFontCharMap")) +(defentry ftglRenderFont (int string int) (void "gacela_ftglRenderFont")) +(defentry ftglDestroyFont (int) (void "gacela_ftglDestroyFont"))