Some changes
This commit is contained in:
14
util/font.c
14
util/font.c
@@ -13,10 +13,10 @@ prepText(SDL_Renderer *renderer, unsigned char pxSize, const char *file, uint8_t
|
||||
unsigned int i = 1;
|
||||
do {
|
||||
if (i == 173) { //specifically this char is 0 width (IDK why)
|
||||
out.surface[i] = SDL_CreateRGBSurface(0,pxSize,pxSize,32,0,0,0,0);
|
||||
out.surface[i] = SDL_CreateRGBSurface(0, pxSize, pxSize, 32, 0, 0, 0, 0);
|
||||
} else {
|
||||
char tmpOut[2] = {i, 0};
|
||||
out.surface[i] = TTF_RenderText_Solid(gFont, tmpOut, out.color);
|
||||
char tmpOut[2] = {i, 0};
|
||||
out.surface[i] = TTF_RenderText_Solid(gFont, tmpOut, out.color);
|
||||
}
|
||||
out.texture[i] = SDL_CreateTextureFromSurface(renderer, out.surface[i]);
|
||||
i++;
|
||||
@@ -51,7 +51,11 @@ void renderText(SDL_Renderer *renderer, BitmapFont font, char *string, uint16_t
|
||||
|
||||
void destroyFont(BitmapFont *font) {
|
||||
for (uint16_t i = 1; i < 256; i++) {
|
||||
SDL_DestroyTexture(font->texture[i]);
|
||||
SDL_FreeSurface(font->surface[i]);
|
||||
if (font->texture[i]) {
|
||||
SDL_DestroyTexture(font->texture[i]);
|
||||
}
|
||||
if (font->surface[i]) {
|
||||
SDL_FreeSurface(font->surface[i]);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user