SDL Wiki
[ front page | index | search | recent changes | git repo | offline html ]

Migrating to SDL_ttf 3.0

This guide provides useful information for migrating applications from SDL_ttf 2.0 to SDL_ttf 3.0.

Functions that previously returned a negative error code now return bool.

Code that used to look like this:

    if (TTF_Function() < 0 || TTF_Function() == -1) {
        /* Failure... */
    }

or

    if (TTF_Function() == 0) {
        /* Success... */
    }

or

    if (!TTF_Function()) {
        /* Success... */
    }

should be changed to:

    if (TTF_Function()) {
        /* Success... */
    } else {
        /* Failure... */
    }

Several functions have been renamed. We have provided a handy semantic patch to migrate more easily to SDL3: SDL_migration.cocci

In general we have switched to using UTF8 in the API. Functions which had 3 variants, for Latin-1, UTF-8, and UCS2, now accept UTF-8 text. In addition, those functions now have an optional length parameter which allows you to render substrings.

The alpha in background colors is now transparent if it's equal to 0.

The following functions have been renamed:

The following functions have been removed:

The following macros have been removed:

The following symbols have been renamed:


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.