MCPcopy Create free account
hub / github.com/InkboxSoftware/all-screen-keyboard / textureLoadFromFont

Function textureLoadFromFont

keyboard/src/texture.cpp:130–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130GLuint textureLoadFromFont(const char* filename, const char* string, int size, SDL_Color color){
131 //load font and render text to SDL surface
132 TTF_Init();
133 TTF_Font* font = TTF_OpenFont(filename, size);
134 SDL_Surface* textureSurface2 = TTF_RenderUTF8_Blended(font, string, color);
135 SDL_Surface* textureSurface = SDL_ConvertSurfaceFormat(textureSurface2, SDL_PIXELFORMAT_RGBA32, 0);
136 if (!textureSurface){
137 SDL_Log("text surface failed: %s\n", TTF_GetError());
138 }
139
140 return SDLsurfaceToGLuint(textureSurface, filename);
141}
142
143GLuint textureFromSDLSurface(SDL_Surface* surface){
144 return SDLsurfaceToGLuint(surface, "video file");

Callers 2

drawTextMethod · 0.85
drawTextMethod · 0.85

Calls 1

SDLsurfaceToGLuintFunction · 0.85

Tested by

no test coverage detected