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

Author Topic: Maximize Window  (Read 14071 times)

0 Members and 1 Guest are viewing this topic.

Vicker

  • Newbie
  • *
  • Posts: 13
    • View Profile
Maximize Window
« on: June 05, 2013, 12:58:59 am »
Is there a way to create a maximized window, or to tell a window to maximize?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Maximize Window
« Reply #1 on: June 05, 2013, 01:05:35 am »
Fullscreen: Yes, see the window's constructor or create() documentation

Maximized: Yes, get the desktop resolution from sf::VideoMode and create window with corresponding size (keep in mind the borders and task bar)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Vicker

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Maximize Window
« Reply #2 on: June 05, 2013, 03:00:25 am »
Fullscreen: Yes, see the window's constructor or create() documentation

Maximized: Yes, get the desktop resolution from sf::VideoMode and create window with corresponding size (keep in mind the borders and task bar)

Neither of those options are truly maximizing the window. 

The issue with the method of using sf::VideoMode to get the desktop size is that it ignores the size of task bars and title bars.  This ends up creating a window that is too big.  A correctly maximized window fills up most of the screen, but leaves room for the task bars and the window's title bar.

Fullscreen doesn't work for my purposes.  I need a maximized window, not a fullscreen window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Maximize Window
« Reply #3 on: June 05, 2013, 07:52:34 am »
No, there's no way with SFML.
Laurent Gomila - SFML developer

Vicker

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Maximize Window
« Reply #4 on: June 05, 2013, 10:00:06 pm »
No, there's no way with SFML.

That's a shame.  Out of curiosity, is maximizing a window in some way more difficult than the other options that sfml does provide? 

I can probably come up with a kludge for my program by maximizing a gtk+ window, measuring it, and then using its dimensions to set the size of the sfml window, but that's certainly not the most elegant solution.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Maximize Window
« Reply #5 on: June 05, 2013, 10:08:27 pm »
Quote
Out of curiosity, is maximizing a window in some way more difficult than the other options that sfml does provide?
No, it's just a choice ;)

SFML is not a dedicated windowing library, so it has a lot less features compared to GTK, Qt, wxWidgets, etc. However, maximizing a window is one of the options that might be added to SFML 2.
Laurent Gomila - SFML developer

Phanoo

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Re: Maximize Window
« Reply #6 on: July 11, 2017, 07:43:54 pm »
still not done what a surprise

Hapax

  • Hero Member
  • *****
  • Posts: 3383
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Maximize Window
« Reply #7 on: July 11, 2017, 07:57:08 pm »
still not done what a surprise
SFML 2 provides access to the window's OS handle now so you should be able to use (simple?) OS-specific functions to maximise an SFML window.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Phanoo

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Re: Maximize Window
« Reply #8 on: August 31, 2017, 10:16:50 am »
I know, but it should be added, window minimizing/maximizing are basic functions for any lib that does  windowing, nothing that advanced... doing it os-specific breaks the purpose of using sfml

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: Maximize Window
« Reply #9 on: August 31, 2017, 02:25:03 pm »
To quote Laurent:
SFML is not a dedicated windowing library...

Further more, nothing prevents you from doing it and making a pull request. You have to remember that the people that works on the library are doing in their own free time. Any help from the community is welcomed.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

Drifty Pine

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Maximize Window
« Reply #10 on: August 10, 2018, 07:11:49 pm »
Hi, I was interested in maximizing/minimizing my window and found this thread. I realize this thread is a year old, but since no example was given and it is so simple on MS-Windows, I thought I would show the code to save anyone who needed to do it some time.

First include the windows header:

#include <windows.h>


Create your window with sf::Window or sf::RenderWindow as usual:

sf::RenderWindow window{sf::VideoMode{window_width, window_height}, "My Window Title"};


Then call the MS-Windows O/S ShowWindow() function to change the window state to maximized:

::ShowWindow(window.getSystemHandle(), SW_MAXIMIZE);


Also, there is a detailed and active discussion about adding various window state changing functionality to SFML that can be found here:
https://en.sfml-dev.org/forums/index.php?topic=23578.0

 

anything