Giter Site home page Giter Site logo

cl-sdl2-ttf's Introduction

CL-SDL2-TTF

This is a wrapper for the SDL2_TTF library used for loading fonts and creating text assets. The library, in it's current state, can load TTF and OTF fonts and render fonts with the three different rendering modes provided by the C library (solid, shaded, and blended). While Latin text, UTF8, UNICODE, and Glyph text rendering is available only Latin text has been tested (as shown in the examples). Functions dealing with font/text attributes (e.g. querying font size, font outline, font style) are not provided yet however, if you do need them leave an issue, or if you're feeling generous, feel free to help out and send a pull request.

Usage

Management Functions

  • (sdl2-ttf:init): Initializes the SDL TTF module. While this needs to be called prior to any subsequent SDL TTF function calls, (with the exception of was-init or linked-version), it does not require the main SDL library to be initialized first. Calls TTF_Init
  • (sdl2-ttf:was-init): Returns 1 if initialized zero otherwise. Calls TTF_WasInit
  • (sdl2-ttf:linked-version): Returns the linked version Major Minor and Patch. Useful for debugging. Calls TTF_Linked_Version
  • (sdl2-ttf:quit): Cleans up the TTF API. Calls TTF_Quit
  • (sdl2-ttf:open-font path-to-font point-size): Open a font specified by the path specifier path-to-font sized to integer point-size (based on 72DPI). Returns a ttf-font struct and null on errors. Calls TTF_OpenFont
  • (sdl2-ttf:close-font ttf-font-struct): Frees the memory associated with a given font struct. Calls TTF_CloseFont

Rendering functions.

How SDL TTF renders fonts

Text is rendered by calling one of 12 methods, each one specifying a type of text

  • Text which refers to LATIN1 encoding
  • UTF8 which refers to UTF8 encoding
  • UNICODE which refers to unicode encoding (text)
  • Glyph, which is unicode encoding (glyphs)

as well as specfying one rendering method

  • Solid
  • Shaded
  • Blended

For example, solid LATIN1 text is TTF_RenderText_Solid, while blended UTF8 text is TTF_RenderUTF8_Blended. This library follows a more traditional Lisp function name structure and omits the TTF before every function. So the above two functions are render-text-solid and render-utf8-blended respectively. Each method takes the font, created with open-font, the text should be rendered in, the text to be rendered, and the red, green blue and alpha components of the color to render in. More in-depth coverage about the rendering methods and the functions themselves are detailed here. Below is a list of functions provided by the wrapper

  • render-text-solid
  • render-utf8-solid
  • render-unicode-solid
  • render-glyph-solid
  • render-text-shaded
  • render-utf8-shaded
  • render-unicode-shaded
  • render-glyph-shaded
  • render-text-blended
  • render-utf8-blended
  • render-unicode-blended
  • render-glyph-blended

Usage with Open GL

Each of the rendering functions returns a surface, however the only one useful for rendering in Open GL are the blended methods, as they produce an ARGB surface. Solid and blended provide a rather strange RGB formatted surface that does something with the alpha you pass in during the rendering call, which does some calculation that my lead to unexpected behavior (if you find otherwise please, let me know). Once you have obtained a surface simply use surface-pixels to obtain the raw pixel data to texture your surface. Note in order for the colors to be correct please be sure to enable blending and chose an appropriate blending function.

Examples

There are two example one using sdl renderers while the other uses OpenGL. To run it load the sdl2-ttf-examples package and run (ttf-examples:basic-example) or (ttf-examples:gl-example)

##Credits

  • Latin font test: Probe 10px otf regular by Andrew Sigurow. No modifications were made to this font, however I simply included the .otf file distributed in the zip linked above

Issues

if you cannot load cl-sdl-ttf, please ensure you have SDL_TTF 2.0 installed and not just 1.2.

If you are sure all of this is correct, and it still will not load, please file an issue and specify

  • Your platform and architecture
  • Your Common Lisp implementation
  • The absolute path to your installed .so, .dylib, .dll, or appropriate OSX framework

cl-sdl2-ttf's People

Contributors

cbaggers avatar failproofshark avatar knusbaum avatar mfiano avatar pkulev avatar reinuseslisp avatar tatrix avatar vydd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cl-sdl2-ttf's Issues

can't load sdlt-ttf on ubuntu 19.04

I have libsdl-ttf2.0-0:amd64 and libsdl-ttf2.0-dev:amd64 installed and they install:

libsdl-ttf2.0-0: /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0
libsdl-ttf2.0-0: /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0.10.1
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/README
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/changelog.Debian.gz
libsdl-ttf2.0-0: /usr/share/doc/libsdl-ttf2.0-0/copyright
libsdl-ttf2.0-0: /usr/share/lintian/overrides/libsdl-ttf2.0-0

but CFFI doesn't look for libSDL_ttf-2.0.so.0 in /usr/lib/x86_64-linux-gnu/ so it fails to find the .so file.

Error calling finalizer #<CLOSURE (LAMBDA () :IN SDL2-TTF:RENDER-TEXT-SOLID)

Hello, I have been using sdl2-ttf and found that some finalizer in sdl2-ttg:render-text-solid crashes sbcl.
The interval at which this crashes is random so the only way to reproduce this issue is just calling the function over and over again in a loop and see where it fails.
I got 2 errors when running this code

(require :sdl2)
(require :sdl2-ttf)

(defun main ()
  (sdl2-ttf:init)
  (sdl2:with-init (:everything)
    (sdl2:with-window (win :title "Hello world" :flags '(:shown) :w 320 :h 240)
      (let ((surf (sdl2:get-window-surface win))
            (font (sdl2-ttf:open-font (truename "kongtext.ttf") 16)))
        (sdl2:with-event-loop (:method :poll)
          (:idle ()
           ;fill with black screen, nil means whole surface
           (sdl2:fill-rect surf nil (sdl2:map-rgb (sdl2:surface-format surf) #x00 #x00 #x00))
           (let ((text_surf (sdl2-ttf:render-text-solid font
                                                        "Hello world"
                                                        #xff #xff #xff #x00)))
             (sdl2:blit-surface text_surf nil surf nil)
             (sdl2:free-surface text_surf))
           (sdl2:update-window win)
           (sdl2:delay 30))
          (:quit () (progn
                      (sdl2-ttf:close-font font)
                      (sdl2-ttf:quit)
                      t)))))))

The first error I got was this

* (main)
double free or corruption (out)
fatal error encountered in SBCL pid 16748(tid 0x7f200457f700)CORRUPTION WARNING in SBCL pid 16748(tid 0x7f201d377700):
Memory fault at 0x18 (pc=0x7f2023f53f21, sp=0x7f201d375de0)
:
SIGABRT received.


The integrity of this image is possibly compromised.
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
Continuing with fingers crossed.
ldb> 
debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD "SDL2 Main Thread" RUNNING {1004F83AA3}>:
  Unhandled memory fault at #x18.

The second error I got was directly from sdl2-ttf

* (main)
NIL
* (main)
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100583506B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B681E3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {1005834C4B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B813A3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at (nil) (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100581126B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B82613}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x10000000098 (pc=0x7f883e521b91, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100583642B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B83883}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {1005834FEB}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B84AF3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {10058363AB}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B85D63}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {1005834F6B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B86FD3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100583632B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B88243}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100583562B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B894B3}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {1005834EEB}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B8A723}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x14a (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {10058362AB}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B8B993}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {10058355AB}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B8CC03}>
CORRUPTION WARNING in SBCL pid 18583(tid 0x7f88238df700):
Memory fault at 0x7f88beef0388 (pc=0x7f883e521b89, sp=0x7f88238de670)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {100581158B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {1001B8DE73}>
INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution

debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread
#<THREAD "finalizer" RUNNING {1001B60053}>:
  Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.

PROCEED WITH CAUTION.
NIL
* 

Above attached is the code I used to reproduce this problem. I need to call this function repeatedly to update the text gradually in one of my projects. This can happen at any time. So to reproduce just run the code above and wait. It should crash eventually.
I am not sure if it is something I am doing wrong but the error message suggests the problem is in some finalizer.

How to use render-unicode-blended ?

i want to render 123
(setf font0 (sdl2-ttf:open-font "/home/peiman/Desktop/Dev/lisp-draft/font.ttf" 40))
(setf text-surface (sdl2-ttf:render-unicode-blended font0 "u0031 u0032 u0033" 255 0 255 0))

but its not render properly
i want to render persian symbols
can you show me an example of using this function please.

Can't load it

platform: Windows 10
architecture: Intel x86-64
Implementation: CCL
DLL Path: "C:\quicklisp\SDL2 DLLS\SDL2_ttf.dll"

The dll path is set in the path enviornment variable, as all other SDL2 libraries can be run(gfx, image, mixer), it's only ttf that doesn't work.

The error I get:

Subprocess (:PROCESS
            #<EXTERNAL-PROCESS (#1=gcc #2=-o
                                #3=C:/Users/sveny/AppData/Local/cache/common-lisp/ccl-1.11-f96-win-x64/c/quicklisp/dists/quicklisp/software/cffi_0.22.1/libffi/libffi-types__grovel-tmp70D3CAC9.obj
                                ...)[NIL] (ERROR : 2) #x2101EF3B1D>)
 with command (#1# #2# #3# "-c" "-m64"
               "-Ic:/quicklisp/dists/quicklisp/software/cffi_0.22.1/"
               "C:/Users/sveny/AppData/Local/cache/common-lisp/ccl-1.11-f96-win-x64/c/quicklisp/dists/quicklisp/software/cffi_0.22.1/libffi/libffi-types__grovel.c")
 exited with error code 2
   [Condition of type CFFI-GROVEL:GROVEL-ERROR]

Unable to load on OS X 10.11

Hello,

I'm trying to load this by running:

(ql:quickload :sdl2-ttf)

but I get the error

Undefined foreign type: TTF-FONT
   [Condition of type AUTOWRAP:UNDEFINED-FOREIGN-TYPE]

Restarts:
 0: [RETRY-COMPILE-FILE] Retry compiling #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp"
 1: [SKIP-COMPILE-FILE] Skip compiling #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp"
 2: [RETRY] Retry compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">.
 3: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap"> as having been successful.
 4: [RETRY] #<error printing RESTART #x2453BA4D>
 5: [CLEAR-CONFIGURATION-AND-RETRY] #<error printing RESTART #x2453BA9D>
 --more--

Backtrace:
  0: (AUTOWRAP::%UNDEFINED-TYPE-ERROR-NO-CONTEXT SDL2-FFI::TTF-FONT)
  1: (AUTOWRAP:DEFINE-WRAPPER (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
  2: (FUNCALL #<Compiled-function AUTOWRAP:DEFINE-WRAPPER Macroexpander #x3020014C14EF> (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
  3: (MACROEXPAND-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
  4: (CCL::FCOMP-MACROEXPAND-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
  5: (CCL::FCOMP-FORM-1 (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
  6: (CCL::FCOMP-FORM (AUTOWRAP:DEFINE-WRAPPER SDL2-FFI::TTF-FONT #<Package "SDL2-FFI">) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
  7: (CCL::FCOMP-FORM-LIST ((SETF AUTOWRAP::*FAILED-WRAPS* NIL) (SETF AUTOWRAP::*MUTE-REPORTING-P* T) ..)) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :COMPILE-TIME-TOO)
  8: (CCL::FCOMP-EVAL-WHEN (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
  9: (CCL::FCOMP-FORM (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
 10: (CCL::FCOMP-FORM-LIST ((EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..))) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
 11: (CCL::FCOMP-FORM (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ..)) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-COMPILE-TIME)
 12: (CCL::FCOMP-FORM (AUTOWRAP:C-INCLUDE '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC "SDL2_ttf.h") :FUNCTION-PACKAGE :SDL2-FFI.FUNCTIONS :SPEC-PATH ...) #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD> :NOT-CO..
 13: (CCL::FCOMP-READ-LOOP "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "home:quicklisp;local-projects;cl-sdl2-ttf;src;autowrap.lisp.newest" 0 #<CCL::LEXICAL-ENVIRONMENT #x302002AC0..
 14: (CCL::FCOMP-FILE "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "home:quicklisp;local-projects;cl-sdl2-ttf;src;autowrap.lisp.newest" 0 #<CCL::LEXICAL-ENVIRONMENT #x302002AC03CD>)
 15: (CCL::%COMPILE-FILE "/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" "/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/aut..
 16: (COMPILE-FILE #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" :OUTPUT-FILE #P"/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-projects/cl-sdl2-..
 17: (UIOP/UTILITY:CALL-WITH-MUFFLED-CONDITIONS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL UIOP/LISP-BUILD:COMPILE-FILE*) #x302002AC0B4F> NIL)
 18: (UIOP/PATHNAME:CALL-WITH-ENOUGH-PATHNAME #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL ..))
 19: (UIOP/LISP-BUILD:COMPILE-FILE* #P"/Users/Nate/quicklisp/local-projects/cl-sdl2-ttf/src/autowrap.lisp" :OUTPUT-FILE #P"/Users/Nate/.cache/common-lisp/ccl-1.11-f96-macosx-x64/Users/Nate/quicklisp/local-..
 20: (FUNCALL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL ASDF/LISP-ACTION:PERFORM-LISP-COMPILATION) #x302002AC0CEF>)
 21: (ASDF/LISP-ACTION:PERFORM-LISP-COMPILATION #<COMPILE-OP > #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">)
 22: (CCL::%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL #<STANDARD-METHOD ASDF/ACTION:PERFORM (ASDF/LISP-ACTION:COMPILE-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)> . 76034347))
 23: (CCL::%%STANDARD-COMBINED-METHOD-DCODE ((#<STANDARD-METHOD ASDF/ACTION:PERFORM :BEFORE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)>) ..))) 76034347)
 24: (NIL #<Unknown Arguments>)
 25: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T)> . 76034390))
 26: (#<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)> #<COMPILE-OP > #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">)
 27: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)> #<STANDARD-METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T)>) 76034390)
 28: (NIL #<Unknown Arguments>)
 29: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)> ((#<COMPILE-OP > . #<SYSTEM "alexandria">) (#<COMPILE-OP > . #<SYSTEM "defpackage-plus">) (#<COMPILE-OP > . #<MODULE "trivial-features" "src">) ..))) ..
 30: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)> . 76034452))
 31: (CCL::CALL-WITH-COMPILATION-UNIT #<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF/PLAN:PERFORM-PLAN :AROUND (T))) #x2453B62F> :OVERRIDE NIL)
 32: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> ((#<COMPILE-OP > . #<SYSTEM "alexandria">) (#<COMPILE-OP > . #<SYSTEM "defpackage-plus">) ..))))
 33: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (LIST)>) 76034452)
 34: (NIL #<Unknown Arguments>)
 35: (CCL::%CALL-NEXT-METHOD (NIL #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (T)> . 76034506))
 36: (CCL::CALL-WITH-COMPILATION-UNIT #<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY (ASDF/PLAN:PERFORM-PLAN :AROUND (T))) #x2453B75F> :OVERRIDE NIL)
 37: (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<ASDF/PLAN:SEQUENTIAL-PLAN #x302002A0C0CD>)
 38: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)> #<STANDARD-METHOD ASDF/PLAN:PERFORM-PLAN (T)>) 76034506)
 39: (NIL #<Unknown Arguments>)
 40: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL)
 41: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL))
 42: ((:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))))
 43: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> #<LOAD-OP :VERBOSE NIL> #<SYSTEM "sdl2-ttf"> :VERBOSE NIL)
 44: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #> #<#>) NIL ..))) 76034582)
 45: (NIL #<Unknown Arguments>)
 46: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD ASDF/OPERATE:OPERATE (SYMBOL T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL))
 47: ((:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))))
 48: (ASDF/CACHE:CALL-WITH-ASDF-CACHE #<COMPILED-LEXICAL-CLOSURE (:INTERNAL (ASDF/OPERATE:OPERATE :AROUND (T T))) #x302002A0C6DF> :OVERRIDE NIL :KEY NIL)
 49: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL)
 50: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #>) NIL ..) 76034670)
 51: (NIL #<Unknown Arguments>)
 52: (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> ASDF/LISP-ACTION:LOAD-OP "sdl2-ttf" :VERBOSE NIL)
 53: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :AROUND (T T)> (#<STANDARD-METHOD ASDF/OPERATE:OPERATE :BEFORE #>) NIL ..) 76034707)
 54: (NIL #<Unknown Arguments>)
 55: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) #x302002A0CFEF>)
 56: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "sdl2-ttf" :PROMPT NIL)
 57: (#<STANDARD-METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)> #<QL-IMPL:CCL #x302000A42D0D> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL QUICKLISP-CLIENT::QL ..))
 58: (#<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)> (:SDL2-TTF) :PROMPT NIL :VERBOSE NIL)
 59: (CCL::%CALL-NEXT-METHOD ((NIL) #<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)> :SDL2-TTF))
 60: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<COMPILED-LEXICAL-CLOSURE (:INTERNAL (QUICKLISP-CLIENT:QUICKLOAD :AROUND (T))) #x302002A0786F>)
 61: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD :AROUND (T)> #<STANDARD-METHOD QUICKLISP-CLIENT:QUICKLOAD (T)>) 76034813)
 62: (NIL #<Unknown Arguments>)
 63: (CCL::CALL-CHECK-REGS QUICKLISP-CLIENT:QUICKLOAD :SDL2-TTF)
 64: (CCL::CHEAP-EVAL (QUICKLISP-CLIENT:QUICKLOAD :SDL2-TTF))
 65: (SWANK::EVAL-REGION "(ql:quickload :sdl2-ttf)\n")
 66: ((:INTERNAL SWANK::REPL-EVAL))
 67: (SWANK::TRACK-PACKAGE #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07AFF>)
 68: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07B7F>)
 69: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::REPL-EVAL) #x302002A07BBF>)
 70: (SWANK::REPL-EVAL "(ql:quickload :sdl2-ttf)\n")
 71: (CCL::CALL-CHECK-REGS SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n")
 72: (CCL::CHEAP-EVAL (SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n"))
 73: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(ql:quickload :sdl2-ttf)\n") "COMMON-LISP-USER" 75)
 74: (SWANK::PROCESS-REQUESTS NIL)
 75: ((:INTERNAL SWANK::HANDLE-REQUESTS))
 76: ((:INTERNAL SWANK::HANDLE-REQUESTS))
 77: (SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x30200059BD2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::HANDLE-REQUESTS) #x30200073FEBF>)
 78: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x30200073EE7D>) (*STANDARD-INPUT* . #<SWANK-BACKEND::SLIME-INPUT-STREAM #x30200073F1ED>) ..))) #<COMPILED-LEXICAL..
 79: (SWANK::HANDLE-REQUESTS #<MULTITHREADED-CONNECTION #x302000626EDD> NIL)
 80: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS repl-thread(11) [Active] #x30200072E0DD> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x30200072DE6F>))
 81: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS repl-thread(11) [Active] #x30200072E0DD> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x30200072DE6F>))
 82: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))

I am running CCL: "Version 1.11-r16635 (DarwinX8664)" on OS X 10.11 and I have SDL2_TTF version 2.0 installed to /Library/Frameworks/.

Unhandled memory fault + Error calling finalizer

Hi!

The following code runs fine for a few seconds (shows the text just fine)

(ql:quickload 'sdl2)
(ql:quickload 'sdl2-ttf)
(ql:quickload 'font-discovery)

(defmacro with-texture (texture-sym renderer surface &body body)
  `(let ((,texture-sym (sdl2:create-texture-from-surface ,renderer ,surface)))
     (unwind-protect
          (progn ,@body)
       (sdl2:destroy-texture ,texture-sym))))

(defmacro with-surface (surface-sym surface &body body)
  `(let ((,surface-sym ,surface))
     (unwind-protect
          (progn ,@body)
       (sdl2:free-surface ,surface-sym))))

(let ((font-path (org.shirakumo.font-discovery:file
                  (org.shirakumo.font-discovery:find-font :family "" :spacing :monospace)))
      (point-size 40))
  (sdl2:with-init (:everything)
    (sdl2-ttf:init)
    (sdl2:with-window (the-window :title "Basic Font Example" :w 300 :h 300 :flags '(:shown))
      (sdl2:with-renderer (my-renderer the-window :flags '(:accelerated))
        (let ((font (sdl2-ttf:open-font font-path point-size)))
          (sdl2:with-event-loop (:method :poll)
            (:idle ()
                   (sdl2:set-render-draw-color my-renderer 0 0 0 255)
                   (sdl2:render-clear my-renderer)
                   (with-surface surface (sdl2-ttf:render-text-solid font "tnetnet" 255 255 255 0)
                     (with-texture hello-text my-renderer surface
                       (sdl2:render-copy my-renderer
                                         hello-text
                                         :source-rect (cffi:null-pointer)
                                         :dest-rect (sdl2:make-rect
                                                     (round (- 150 (/ (sdl2:texture-width hello-text) 2.0)))
                                                     (round (- 150 (/ (sdl2:texture-height hello-text) 2.0)))
                                                     (sdl2:texture-width hello-text)
                                                     (sdl2:texture-height hello-text)))))
                   (sdl2:render-present my-renderer))
            (:quit ()
                   (when (> (sdl2-ttf:was-init) 0)
                     (sdl2-ttf:close-font font)
                     (sdl2-ttf:quit))
                   t)))))))

and then crashes with:

Unhandled memory fault at #x10014.
   [Condition of type SB-SYS:MEMORY-FAULT-ERROR]

and prints:

WARNING:
   Error calling finalizer #<CLOSURE (LAMBDA ()
                                       :IN
                                       SDL2-TTF:RENDER-TEXT-SOLID) {10064E1A2B}>:
  #<SB-SYS:MEMORY-FAULT-ERROR {100489D293}>

Checked on SBCL 2.0.3 and 2.0.5-1.

What could be the problem here? Is it CL-SDL2 bug?

was-init returns integer

sdl2-ttf:was-init returns 0 when it's not initialized and 1 when initialized. It'd be easy to change so it returns t and nil, but it may break API contract with existing applications.

CL-USER> (sdl2-ttf:was-init)
0
CL-USER> (sdl2-ttf:init)
0
CL-USER> (sdl2-ttf:was-init)
1

Does not build with latest cl-sdl2

I get this:

; caught ERROR:
;   during macroexpansion of (AUTOCOLLECT (PTR) (CHECK-NULL #) ...). Use *BREAK-ON-SIGNALS* to intercept.
;    Trying to use AUTOCOLLECT without TRIVIAL-GARBAGE

Some cl-sdl2 functions cause render-text-blended to render erratic, overlapping characters

The following code is the minimum recreateable example I could come up with from my bigger project. It's supposed to display the name of the keys the user types in, spaced out appropriately. Instead, after one or two keys it starts to display erratic characters overlapping each other.

Compiled with trivial-dump-core
With SBCL 2.0.1.debian
On Linux Mint 20.3

(require 'sdl2)
(require 'sdl2-ttf)

(defparameter *screen-width* 640)
(defparameter *screen-height* 480)
(defparameter *current-x* 0)

(defun get-text-size (font text)
  (list :w (first (multiple-value-list (sdl2-ttf:size-text font text)))
        :h (second (multiple-value-list (sdl2-ttf:size-text font text)))))

(defun create-text-surface (renderer font text)
   (let* ((sdl-surface (sdl2-ttf:render-text-blended 
                              font
                              text
                              #xff
                              #xff
                              #xff
                              #xff))
          (sdl-texture (sdl2:create-texture-from-surface renderer sdl-surface))
          (final-texture (sdl2:create-texture renderer
                                              :argb8888
                                              :target
                                              (getf (get-text-size font text) :w)
                                              (getf (get-text-size font text) :h))))
     (sdl2:set-texture-blend-mode sdl-texture :blend)
     (sdl2:set-texture-blend-mode final-texture :blend)
     (sdl2:set-render-target renderer final-texture)
     (sdl2:render-copy renderer sdl-texture)
     (sdl2:set-render-target renderer nil)
     (sdl2:free-surface sdl-surface)
     (sdl2:destroy-texture sdl-texture)
     final-texture))

(defun display-text (texture renderer font text)
  (let ((text-texture (create-text-surface renderer font text))
        (dest-rect (sdl2:make-rect *current-x* 
                                   0 
                                   (getf (get-text-size font text) :w)
                                   (getf (get-text-size font text) :h))))
    (sdl2:render-copy renderer texture :dest-rect dest-rect)
    (incf *current-x* (sdl2:rect-width dest-rect))
    (sdl2:set-render-target renderer texture)
    (sdl2:render-copy renderer text-texture :dest-rect dest-rect)
    (sdl2:set-render-target renderer nil)
    (sdl2:destroy-texture text-texture)))
                                   

(defun run()
  (sdl2-ttf:init)
  (sdl2:with-init (:everything)
    (sdl2:with-window (window :title "SDL2 Tutorial 01"
                              :w *screen-width*
                              :h *screen-height*
                              :flags '(:shown))
      (sdl2:with-renderer (renderer
                            window
                            :index -1
                            :flags '(:accelerated))
      (sdl2:set-render-draw-blend-mode renderer :blend)
      (sdl2:set-render-draw-color renderer #x22 #x22 #x22 #xff)
      (let ((key nil)
            (font (sdl2-ttf:open-font "fonts/LiberationMono-Regular.ttf" 13))
            (main-texture (sdl2:create-texture renderer
                                               :argb8888
                                               :target
                                               640
                                               480)))
        (sdl2:set-texture-blend-mode main-texture :blend)
        (sdl2:with-event-loop (:method :poll)
          (:quit () t)
          (:keydown (:keysym keysym)
            (setf key (string-downcase (sdl2:get-key-name (sdl2:get-key-from-scancode (sdl2:scancode keysym)))))
            (display-text main-texture renderer font key))
          (:idle ()
           (sdl2:render-clear renderer)
           (sdl2:render-copy renderer main-texture)
           (sdl2:render-present renderer)))
        (sdl2:destroy-texture main-texture)
        (sdl2-ttf:close-font font)))))
  (sdl2-ttf:quit))

A few things I've discovered:

The same executable works fine on my laptop running Manjaro.

The bug doesn't happen when I comment out the call to sdl2:set-render-draw-color in run.

The bug also doesn't happen when I comment out the calls to sdl2:free-surface and sdl2:destroy-texture in create-text-surface.

The bug doesn't happen when I change from an accelerated renderer to a software renderer.

I'm new to submitting github issues, so I apologize if I've gotten etiquette wrong.

Loading fails on OpenBSD

Hi, I get an error on OpenBSD.

Spec folder doesn't seem to have SDL2ttf.h but only SDL_ttf.h

The idea here is that c2ffi (which I compiled already successfully) generates the spec file for OpenBSD ?

Thanks!

My log:

`To load "sdl2-ttf":
Load 1 ASDF system:
sdl2-ttf
; Loading "sdl2-ttf"
..............
; pkg-config libffi --cflags
-I/usr/local/include
; cc -o /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmpTT1OWD6.o -c -O2 -pipe -g -g -Wall -Wundef -Wsign-compare -Wpointer-arith -I/usr/local/include -fno-omit-frame-pointer -pthread -I/usr/local/include -I/usr/local/include -fPIC -I/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/ /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.c
/home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.c:11:7: warning: unused variable 'autotype_tmp' [-Wunused-variable]
int autotype_tmp;
^
1 warning generated.
; cc -o /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmp9QIWO193 -L/usr/local/lib -g -Wl,--export-dynamic -Wl,-z,wxneeded /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.o
; /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel /home/rpx/.cache/common-lisp/sbcl-2.3.10.openbsd.sbcl-2.3.10-bsd-x64/home/rpx/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.grovel-tmp.lisp
...
; file: /home/rpx/common-lisp/cl-sdl2-ttf/src/autowrap.lisp
; in: AUTOWRAP:C-INCLUDE '(SDL2-TTF AUTOWRAP-SPEC "SDL2_ttf.h")
; (AUTOWRAP:C-INCLUDE
; '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC "SDL2_ttf.h") :FUNCTION-PACKAGE
; :SDL2-FFI.FUNCTIONS :SPEC-PATH '(SDL2-FFI::SDL2-TTF SDL2-FFI::AUTOWRAP-SPEC)
; :EXCLUDE-SOURCES ("/usr/include/") :INCLUDE-SOURCES ("SDL_ttf.h")
; :SYMBOL-EXCEPTIONS (("SDL_RWops" . "SDL-RWOPS")) ...)
;
; caught COMMON-LISP:ERROR:
; (during macroexpansion of (AUTOWRAP:C-INCLUDE '(SDL2-TTF AUTOWRAP-SPEC ...) ...))
; Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {1005228433}>
; with command ("c2ffi" "/home/rpx/common-lisp/cl-sdl2-ttf/src/spec/SDL2_ttf.h"
; "-D" "null" "-M" "/tmp/tmp12YFTKZX-tmp.c" "-A"
; "x86_64-unknown-openbsd")
; exited with error code 1

debugger invoked on a UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {1001430003}>:
COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry
compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">.
1: [ACCEPT ] Continue, treating
compiling #<CL-SOURCE-FILE "sdl2-ttf" "autowrap">
as having been successful.
2: Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
configuration.
4: Retry ASDF operation.
5: Retry ASDF operation after resetting the
configuration.
6: [ABORT ] Give up on "sdl2-ttf"
7: [REGISTER-LOCAL-PROJECTS ] Register local projects and try again.
8: Exit debugger, returning to top level.

(UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sdl2-ttf" "autowrap">)))
error finding frame source: Bogus form-number: the source file has probably
changed too much to cope with.
source: NIL
0] `

Update for library.lisp for OpenBSD needed?

Hi, is it correct to extend for OpenBSD the library.lisp file with "libSDL2_ttf.so.0.1" ?

(:unix (:or "libSDL2_ttf-2.0.so.0" "libSDL2_ttf" "libSDL2_ttf.so.0.1"))

If I don't it doesn't find the lib:

(ql:quickload :sdl2-ttf)
To load "sdl2-ttf":
Load 1 ASDF system:
sdl2-ttf
; Loading "sdl2-ttf"
....................
debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR in thread
#<THREAD "main thread" RUNNING {10013D8003}>:
Unable to load any of the alternatives:
("libSDL2_ttf-2.0.so.0" "libSDL2_ttf")

On my system it's located here:

tron$ ldconfig -r | grep ttf 744:-lSDL2_ttf.0.1 => /usr/local/lib/libSDL2_ttf.so.0.1

Thanks.

Executable binary error on ECL by cl-sdl2-ttf

About the problem that "SDL2" cannot be found when creating an executable binary with ECL

  • ECL 16.1.3
  • x86_64-linux-gnu (Debian 10.2)
  • libsdl2-ttf, libsdl2-ttf-dev

After creating an executable binary with "asdf: make-build", including sdl2-ttf in the dependency will cause the following error:

Condition of type: SIMPLE-ERROR
Module error: Don't know how to REQUIRE SDL2.
No restarts available.

Top level in: # <process TOP-LEVEL>

This problem was solved by deleting the following part of src/general.lisp.

line 3: (require 'sdl)

Even without require, it looks like the execution of the program is not affected. Does a non-ECL implementation cause problems without this code?

(English is not my native language; please excuse typing errors.)

RenderText_Shaded is missing the second color

The Shaded functions seem to be specified same as Blended and Solid, with a single color argument. According to documentation, Shaded functions have an additional color for the background, like this:

SDL_Surface *TTF_RenderText_Shaded(TTF_Font *font, const char *text, SDL_Color fg, SDL_Color bg)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.