SDL .ttf Problem - process returned 3
-
Mein Program kompiliert fehlerfrei, wird aber dann einfach mit Wert 3 beendet.
DEBUGGER sagt folgendes: (hab keine Ahnung vom debuggen)#0 6F4C237B TTF_SizeUNICODE() (C:\Windows\system32\SDL_ttf.dll:??)
#1 6F4C267A TTF_RenderUNICODE_Solid() (C:\Windows\system32\SDL_ttf.dll:??)
#2 6F4C2AD6 TTF_RenderText_Solid() (C:\Windows\system32\SDL_ttf.dll:??)
#3 00401380 SDL_main(args=1, argc=0x342688) (E:/don't_destroy_this_fucking_directory/ttf/main.cpp:25)
#4 00401E9B console_main(argc=1, argv=0x342688) (./src/main/win32/SDL_win32_main.c:246)
#5 00402079 WinMain(hInst=0x400000, hPrev=0x0, szCmdLine=0x552051 "", sw=10) (./src/main/win32/SDL_win32_main.c:382)
#6 00401878 main() (??:??)CODE:
#include "SDL/SDL.h" #include "SDL/SDL_image.h" #include "SDL/SDL_ttf.h" #include <string> using namespace std; SDL_Surface *background = NULL; SDL_Surface *message = NULL; SDL_Surface *screen = NULL; SDL_Event event; TTF_Font *font = NULL; SDL_Color textcolor = {255,255,255}; SDL_Surface * LoadImage(const string &filename); void ApplySurface(short x, short y, SDL_Surface *source, SDL_Surface *desination, SDL_Rect *clip = NULL); bool Init(short x, short y, short BPP); bool LoadFiles(); void clean(); int main(int args, char *argc[]) { if(!Init(900,600,32)) return 1; if(!LoadFiles) return 1; message = TTF_RenderText_Solid(font, "HELLO WORLD!", textcolor); //Hängt sich auf if(message == NULL) { return 1; } background = LoadImage("Hintergrund.jpg"); if(background == NULL) { return 1; } SDL_Delay(5000); clean(); return 0; } SDL_Surface * LoadImage(const string &filename) { SDL_Surface *loadedImage = NULL; SDL_Surface *optimizedImage = NULL; loadedImage = IMG_Load(filename.c_str()); if(loadedImage != NULL) { optimizedImage = SDL_DisplayFormat(loadedImage); SDL_FreeSurface(loadedImage); } return optimizedImage; } void ApplySurface(short x, short y, SDL_Surface *source, SDL_Surface *destination, SDL_Rect *clip) { SDL_Rect offset; offset.x = x; offset.y = y; SDL_BlitSurface(source , clip, destination, &offset); } bool Init(short x, short y, short BPP) { if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { return false; } screen = SDL_SetVideoMode(x,y,BPP,SDL_SWSURFACE); if(screen == NULL) { return false; } if(TTF_Init() == -1) { return false; } SDL_WM_SetCaption("TTF_TEST",NULL); return true; } bool LoadFiles() { background = LoadImage("Hintergrund.jpg"); if(background == NULL) { return false; } font = TTF_OpenFont("font.ttf",24); if(font == NULL) { return false; } return true; } void clean() { SDL_FreeSurface(message); SDL_FreeSurface(background); TTF_CloseFont(font); TTF_Quit(); SDL_Quit(); }Vll. weiß einer von euch weiter.
MfG
Stromberg