SFML community forums

Help => Window => Topic started by: hakeris1010 on October 22, 2014, 07:38:01 pm

Title: How to make window fixed size (cant be resized)?
Post by: hakeris1010 on October 22, 2014, 07:38:01 pm
I cant find how to do it. My program window needs to be always 800x600, and i dont want it to allow resizing, because resizing causes bugs in my program.
Title: Re: How to make window fixed size (cant be resized)?
Post by: Ixrec on October 22, 2014, 07:55:49 pm
The official tutorials cover this: http://sfml-dev.org/tutorials/2.1/window-window.php

The part that answers your question is:
Quote
[sf::Window's] constructor accepts a third optional argument: a style, which allows to choose which decorations and features you want. You can use any combination of the following styles:

  • sf::Style::None   No decoration at all (useful for splash screens, for example); this style cannot be combined with others
  • sf::Style::Titlebar   The window has a titlebar
  • sf::Style::Resize   The window can be resized and has a maximize button
  • sf::Style::Close   The window has a close button
  • sf::Style::Fullscreen   The window is shown in fullscreen mode; this style cannot be combined with others, and requires a valid video mode
  • sf::Style::Default   The default style, which is a shortcut for Titlebar | Resize | Close
Title: Re: How to make window fixed size (cant be resized)?
Post by: AndreeU17 on October 24, 2014, 09:28:17 am
Do what the above user mention:

 
sf::RenderWindow window(sf::VideoMode(400,600), "Example", sf::Style::TitleBar);

everything that you dont provide from the style will not appear, in this case only the titlebar will appear. PS: i wrote that line of code fast, so if it mentions error, i apologies ahead of time!