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

Author Topic: [SOLVED] Window Size problem  (Read 4060 times)

0 Members and 1 Guest are viewing this topic.

eglomer

  • Newbie
  • *
  • Posts: 13
    • View Profile
[SOLVED] Window Size problem
« 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

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

Some idea?

PS: Sorry about my English -.-U

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Size problem
« Reply #1 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.
Laurent Gomila - SFML developer

eglomer

  • Newbie
  • *
  • Posts: 13
    • View Profile
[SOLVED] Window Size problem
« Reply #2 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Size problem
« Reply #3 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...
Laurent Gomila - SFML developer

eglomer

  • Newbie
  • *
  • Posts: 13
    • View Profile
[SOLVED] Window Size problem
« Reply #4 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!

 

anything