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

Author Topic: detect display size  (Read 21518 times)

0 Members and 1 Guest are viewing this topic.

vurentjie

  • Newbie
  • *
  • Posts: 31
    • View Profile
detect display size
« on: June 22, 2008, 10:26:01 pm »
hi,

i was wondering if it was at all possible to include a function that will detect the screen width and height, so that windows can be automatically opened at a maximum size,

i did do a bit of research on the topic, if you do consider adding this feature this might help,


On windows:
Code: [Select]

  screenwidth = (GetSystemMetrics( SM_CXFULLSCREEN ));
  screenheight = (GetSystemMetrics( SM_CYFULLSCREEN ));


On X11:
Code: [Select]

  Display *display_name;

 display_name = XOpenDisplay(NULL);

             screenwidth = DisplayWidth(display_name,screen);
             screenheight = DisplayHeight(display_name,screen);


On mac, using carbon
Code: [Select]

   
   Rect outAvailableRect;

        GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);

        screenwidth = outAvailableRect.right - outAvailableRect.left;
        screenheight = outAvailableRect.bottom - outAvailableRect.top;


I am not sure if these are totally correct or if it is covers all that is needed, but please consider this.

later
vurentjie

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
detect display size
« Reply #1 on: June 23, 2008, 03:02:15 am »
sf::VideoMode::GetDesktopMode() already does that ;)
Laurent Gomila - SFML developer

vurentjie

  • Newbie
  • *
  • Posts: 31
    • View Profile
detect display size
« Reply #2 on: June 23, 2008, 08:48:20 am »
great!