SFML community forums

Help => Window => Topic started by: eglomer on May 27, 2011, 03:08:23 am

Title: [SOLVED] Window Size problem
Post by: eglomer on May 27, 2011, 03:08:23 am
Hi! I have some problems with my window size. I mean, I do that:

Code: [Select]
// 1280x800x32 is my desktop configuration
sys.width = 1280;
sys.height = 800;
sys.bpp = 32;

*  *  *

sf::RenderWindow App;
char title[100] = "";
sprintf (title, "Storm Alarm %d.%d.%d", sys.version, sys.revision, sys.beta);
App.Create(sf::VideoMode(sys.width, sys.height, sys.bpp), title);
App.SetFramerateLimit(15);
App.SetIcon(39, 38,  Icon.GetPixelsPtr() );
App.SetPosition(0,0);
printf ("Width: %d  Height: %d\n", App.GetWidth(), App.GetHeight());


But in DOS console I get:
Code: [Select]
Width:1280  Height: 778

And my window background is incompleted, as the titlebar was eatting up the image, but if I try with 1280x720 or minor I have no problem.

There is a screenshot with the window maximized:
SCREENSHOT (http://dl.dropbox.com/u/971641/error.png)

I'm using SFML 1.6, Windows 7 and CodeLite with g++.

Some idea?

PS: Sorry about my English -.-U
Title: [SOLVED] Window Size problem
Post by: Laurent on May 27, 2011, 07:38:02 am
I think Windows limits the size to the desktop size minus the task bar. You should never try to create windows with a height greater than this value.
Title: [SOLVED] Window Size problem
Post by: eglomer on May 27, 2011, 01:42:55 pm
taskbar isn't the problem because when I start my program I can see it down the taskbar. I think the problem is titlebar. Do you know if it's size is always 22 pixels?
Title: [SOLVED] Window Size problem
Post by: Laurent on May 27, 2011, 02:06:22 pm
Quote
Do you know if it's size is always 22 pixels?

I think it can have any size. Depends on theme, font size, etc...
Title: [SOLVED] Window Size problem
Post by: eglomer on May 27, 2011, 02:52:30 pm
I solved it checking if height is correct and then, adapting my resize system to the height-titlebar_size:

Code: [Select]
sys.width = 1280;
sys.height = 800;
sys.bpp = 32;
sys.titlebar = 0; // titlebar size

* * *

sf::Window proof;
proof.Create(sf::VideoMode(sys.width, sys.height, sys.bpp), "");
sys.titlebar = sys.height - proof.GetHeight();
proof.Close();

if (sys.titlebar != 0){
sys.height -= sys.titlebar;
}

* * *
App.Create(sf::VideoMode(sys.width, sys.height+sys.titlebar, sys.bpp), title);


Thanks for the help, Laurent!