- [FIX] posible leak al carregar el bmp de la font

- [FIX] arreglats un milló de warnings
This commit is contained in:
Raimon @ quifisraimon
2026-09-18 10:51:54 +02:00
parent 791bd7efbd
commit a25c070b07
5 changed files with 24 additions and 15 deletions
+6 -4
View File
@@ -33,7 +33,9 @@ namespace ui
SDL_Texture * createtexture(SDL_Renderer *renderer)
{
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, SDL_LoadBMP("font.bmp"));
SDL_Surface *bmp_surface = SDL_LoadBMP("font.bmp");
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_DestroySurface(bmp_surface);
SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST);
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
return texture;
@@ -124,7 +126,7 @@ namespace ui
void printtxt(int x, int y, const char *text, uint8_t color)
{
SDL_SetTextureColorMod(tex, colors[color][0], colors[color][1], colors[color][2]);
for (int i=0; i<strlen(text);++i) if (text[i]!=32) printchar(x+i, y, text[i]);
for (int i=0; i<(int)strlen(text);++i) if (text[i]!=32) printchar(x+i, y, text[i]);
}
void placechar(int x, int y, char chr, uint8_t color)
@@ -140,7 +142,7 @@ namespace ui
void placetxt(int x, int y, const char *text, uint8_t color)
{
SDL_SetTextureColorMod(tex, colors[color][0], colors[color][1], colors[color][2]);
for (int i=0; i<strlen(text);++i) if (text[i]!=32) placechar(x+i*CHR_W*2, y, text[i]);
for (int i=0; i<(int)strlen(text);++i) if (text[i]!=32) placechar(x+i*CHR_W*2, y, text[i]);
}
void setClicked(const bool value)
@@ -155,7 +157,7 @@ namespace ui
void setDialog(void(*new_dialog)(void))
{
ui:dialog = new_dialog;
ui::dialog = new_dialog;
}
bool hasDialog()