Something is almost working

This commit is contained in:
2025-02-08 23:23:21 +01:00
parent aaf3dfb40c
commit 45653b6372
15 changed files with 969 additions and 326 deletions

View File

@@ -10,13 +10,13 @@ prepText(SDL_Renderer *renderer, unsigned char pxSize, const char *file, uint8_t
BitmapFont out;
out.size = pxSize;
out.color = (SDL_Color) {r, g, b, a};
unsigned char i = 0;
unsigned int i = 1;
do {
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++;
} while (i < 255);
} while (i < 256);
TTF_CloseFont(gFont);
return out;
@@ -43,4 +43,11 @@ void renderText(SDL_Renderer *renderer, BitmapFont font, char *string, uint16_t
outRect.x += charRect.w + 1;
string++;
}
}
void destroyFont(BitmapFont *font) {
for (uint16_t i = 1; i < 256; i++) {
SDL_DestroyTexture(font->texture[i]);
SDL_FreeSurface(font->surface[i]);
}
}