SFML 2.0 Titlebar

I am making a launcher for a game (it isn't finished yet) but does anyone know how to centre the title on the titlebar.

Current code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
bool Menu()
{
    sf::RenderWindow launcher;
    launcher.create(sf::VideoMode(sf::VideoMode::getDesktopMode().width - 500,
    sf::VideoMode::getDesktopMode().height-300),"Launcher",sf::Style::Titlebar);
    bool exit = false, play = false;

    while (launcher.isOpen())
    {
        sf::Event event;
        while(launcher.pollEvent(event))
        {

        }
            launcher.clear(sf::Color::Red);
            launcher.display();

            if (exit == true)
            {
                launcher.close();
                return false;
            }
            else if (play == true)
            {
                launcher.close();
                return true;
            }
        }
    }
That's weird, whenever I've created a title it automatically centers. I don't recognize the sf::Style::Titlebar when I created my window the last parameter was the title, I didn't add anything else. Do you know if that parameter has anything to do with it?
You don't -- the location of the title on the titlebar is up to the OS (and, if given, options the user sets with his OS).

If you really want to be special, you can do several things:

1 - OS-specific code (on Windows) to handle draw events directed at the non-user parts of the window (which are the titlebar and borders).

2 - Open a window without a titlebar and draw one yourself. It will clash with the OS-stuff, and behave differently, but it will look pretty.

Good luck!
Twiggy the sf::Style::Titlebar is only used if you want to change it from default. the default is: resize, titlebar, close. when i only wrote titlebar it got rid of the ability to resize and close the window using the close button.
Well, that's odd, were you trying to change the options? the way I've always done it is _mainWindow.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32), "Game Name"); the 32 in there is for depth, which I didn't use anyway, but this is the way the tutorial told me to render the window so I did. I tried your code and the title shows up in the center, Duoas was right, not that I doubted. but yea the buttons to minimize, maximize, and close buttons were gone. What os are you using?
I am using windows 7
oh.... well I'm honestly not sure how to fix it and apparently its not an option in windows 8, do a google search on centering the title bar in windows 7, other than that I don't know why it would be not centered, like I said I ran your code and it was in the center on my pc
ok thanks
One thing I thought of to ask was, is all the rest of your titles on the title bar centered? like on file explorer or other programs? because if they are then I don't know what is going on. If they all on the side then hopefully you can find a solution on Google (or have you?)
no they aren't
Duoas has already explained the issue at hand. The positioning of the text in the titlebar is controlled by the OS, so to set it manually you would either need to do some OS-specific work or don't have the OS draw it at all and draw one yourself manually.
Just off topic can anyone help me with another problem: http://www.cplusplus.com/forum/general/110023/
Topic archived. No new replies allowed.