Beltar
Member
- Joined
- Feb 13, 2007
- Messages
- 214
- Age
- 34
- Location
- Stein (nähe St. Pölten(A))
- ICQ
- 232357654
- LOCATION
- Stein (nähe St. Pölten(A))
Code:
void textSdl(int x, int y, int width, int height, char * path, int size, int color, std::string str)
{
SDL_Rect dst;
setColorSdl(color);
SDL_Color SdlColor = {re, gr, bl, 255};
TextColor = SdlColor;
if (width > 10 && (x + width) <screen>w)
textWidth = width;
else
textWidth = screen->w - x;
if (height > 0 && (y + height) <screen>h)
textHeight = height;
else
textHeight = screen->h - y;
Font = TTF_OpenFont(path, size);
if (Font == NULL)
{
printf("Can't load font: %s", path);
}
screenBuffer = NULL;
ChangeText(str);
if (Font != NULL && text != "")
{
dst.x = x;
dst.y = y;
SDL_BlitSurface(screenBuffer, NULL, screen, &dst);
}
TTF_CloseFont(Font);
}
Aufruf
Code:
textSdl(30, 30, 140, 20, "./Data/arial.ttf",16, WHITE, "Franz");
Diese funktion habe ich aus der SDL header meiner Schule kopiert. bei anderen Programmen die ich geschrieben habe hat sie schon funktioniert.
Wenn ich es am Computer starte kommt: Can't load font: xxx
Die Datei existiert aber in diesem Pfad und ich habe es auch schon im gleichen Verzeichniss probiert.
Hat wer einen Ahnung was da nicht passt?
mfg
Beltar