Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to make window fixed size (cant be resized)?  (Read 5713 times)

0 Members and 1 Guest are viewing this topic.

hakeris1010

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to make window fixed size (cant be resized)?
« 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.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: How to make window fixed size (cant be resized)?
« Reply #1 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

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: How to make window fixed size (cant be resized)?
« Reply #2 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!