Jump to content
  • Advertisement
Sign in to follow this  
rechmbrs

Screen size (win/unix)

This topic is 4419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Under Windows I'm using the following: if ( EnumDisplaySettings ( NULL, ENUM_CURRENT_SETTINGS, &devmode ) ) { screen_width = devmode.dmPelsWidth; screen_height = devmode.dmPelsHeight; } to get the display screen size. Is it possible to get the display screen size on a MAC or Unix/Linux system? If so, how? Someplace I should look? Thanks, RON C

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately I think you would have to interact with X11, the library that contains what you want i believe is called Xlib. Although, what are you trying to do? because if you're trying to go fullscreen, I highly reccomend just using SDL, its cross platform and will do what you want.

hope that helps
-Dan

EDIT: Wikipedia has a good overview And there is the "Xlib manual" down in the works cited

Share this post


Link to post
Share on other sites
Dan,

Thanks for the response.

I'm using the width/height to make sure the windows I open in opengl will fit. I rearrange if not.

What is needed in x11?

RON C

Share this post


Link to post
Share on other sites
I asked around and apprently gdk_screen_get_width() gtk_screen_get_height() is probably your best bet, but that assumes gtk is present (as opposed to Qt) which means that people running GNOME will certainly have the function, wheras people on KDE won't necessarily (though its probably still a good bet). There IS a way to do it with X11 which everyone is GUARANTEED to have. I'm still looking for it though.

cheers
-Dan

Share this post


Link to post
Share on other sites
I don't think you should add GTK to your application only for display size. Take a look at XDisplayWidth, XDisplayHeight, GetDefaultDisplay, GetDefaultScreen functions of XLib (you can try `man XDisplayWidth` or google)

XLib is very hard to code for, but simply getting the display size shouldn't be that hard.

hope that helps !

Share this post


Link to post
Share on other sites
lemurion,

Thanks.

I have it all coded and now will pass to the programmers on the specific systems.

You guys have been very helpful and especially quick.

RON C

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!