cepl.sdl2-ttf

2018-01-31

A few additional helpers for making working with sdl2-ttf even easier from CEPL

Upstream URL

github.com/cbaggers/cepl.sdl2-ttf

Author

Chris Bagley (Baggers) <techsnuffle@gmail.com>

License

BSD 2 Clause
README

CEPL.SDL2-TTF

A complementary library that adds a couple of simple helpers too ease making CEPL textures using the excellent sdl2-ttf.

API

#'init

Initialized sdl2-ttf only if not already initialized. Also checks that CEPL is initialized.

#'quit

Shuts down sdl2-ttf only if initialized

with-font

A helper macro that opens a font for the scope of the body

#'text-to-tex

This function takes:

  • The string to render to a texture
  • A font object
  • A text color as a vector4 (defaults to (v! 255 255 255 0))

It returns a CEPL texture containing the text.

Example

(defun test ()
  (init)
  (with-font (font (asdf:system-relative-pathname
                    'sdl2-ttf-examples "examples/PROBE_10PX_OTF.otf"))
    (text-to-tex "hello world" font)))

Dependencies (3)

  • cepl.sdl2
  • cl-sdl2-ttf
  • rtg-math

Dependents (0)

    • GitHub
    • Quicklisp