1
我想我做的所有权利,但无论如何,我不认为我的文字。 Official docs很差(或者SDL 2已经过时)。无法看到使用SDL TTF我的文字SDL 2
if (TTF_Init())
printf("%s\n", TTF_GetError());
font = TTF_OpenFont("Fonts/DinCompRegular.ttf", 24);
if (!font)
printf("%s\n", TTF_GetError());
SDL_Color fontColor = { 255, 0, 0, 255 };
u16 text[] = { '2', 's', 'ä', 'Щ' };
SDL_Surface *info = TTF_RenderUNICODE_Solid(font, text, fontColor);
SDL_Rect rect = { info->w, info->h, 0, 0 };
SDL_Surface *place = SDL_CreateRGBSurface(0, info->w, info->h, 32, 0, 0, 0, 0);
而在主循环:
SDL_BlitSurface(info, 0, place, &rect);
SDL_FreeSurface(info);
SDL_RenderPresent(renderer);