SDL_WM_SetCaption not working
any idea why the following code isn't working? Nothing happens when it's called, the window title is still untitled. I'm on Ubuntu linux.
SDL_Init( SDL_INIT_VIDEO );
SDL_WM_SetCaption("Window Title", "Icon Title");
SDL_Surface* screen = SDL_SetVideoMode( 512, 512, 32, SDL_HWSURFACE | SDL_DOUBLEBUF );
Vector2 center = Vector2(256,256);
const char* c = "test";
SDL_WM_SetCaption( c, 0 );
SDL_Event event;
Make your first call to SDL_WM_SetCaption
after SDL_SetVideoMode
has been called. Also, remove the second test call. If you are using SDL 1.3, (it sounds like you are using 1.2, so you can probably ignore this), call SDL_SetWindowTitle
:
Your code may not be at fault. Ubuntu may be responsible for that one. Or rather, the window manager/compositor Compiz that it uses:
https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/257391
Switching from Compiz to Metacity could help you figure out if you are affected by this bug as well.
There may be something else going on: I don't get a title when I call SetCaption after SetVideoMode but I do get one when I set the caption before, which is not the behavior you are observing.
精彩评论