views:

323

answers:

5

Is there any crossplatform way (Windows, Linux, MacOSX) to change screen resolution? Neither Java nor .Net-Mono can do it. Only through native API invocation. It's very strange situation: there are clear (managed) methods to obtain screen resolution, but method for setting is absent. Is this feature very dangerous or complicated? Does any other crossplatform system (Parrot, RealBasic etc.) do this?

A: 

Uhm, it really depends on the platform (win32, Mac OS X, Linux all does this differently [different display drivers]). You should probably be asking yourself why you need to change the screen resolution in the first place.

You could just as easily instead of changing the resolution, render whatever content you have at some lower screen resolution and then scale that to fit (fill) the screen. It's the same thing.

John Leidegren
I need this feature in special crossplatform utility. User of this utility initiate some operations implying resolution change.
macropas
A: 

It's a good question. I'm not aware of any cross-platform system that does it. I once worked on an application that changed the screen resolution automatically, and if I had to do it over again I wouldn't have designed it that way. It's disruptive to the user to change the resolution - somewhat like moving the ground under your feet. LCD monitors have a 'natural' resolution that looks best by far. A user may be very annoyed if you change it away from that.

Look at my comment to John's post
macropas
+1  A: 

actually - setting screen resolution depends on the OS/X-Server. You should think about it if you really need it and then, if you do, you should write some kind of abstraction layer with os-specific implementations. And setting up the testing environment (especially with different Linux-Flavors) will be hell!

+3  A: 

I'm not sure if you're using libSDL, but check this out: http://docs.huihoo.com/sdl/1.2/sdlsetvideomode.html

PS Oh, by the way, if didn't already know, LibSDL is a cross-platform library intended primarily for games. http://www.libsdl.org/

supercheetah
Just to note, there's already a <a href="http://www.libsdl.org/languages.php">couple bindings</a> for C# to sdl.
Tracker1
A: 

There are plenty of devices where you can't change the resolution. Phones, for instance *some of which run Mac OSX or Linux). But even on desktops the ability to change resolutions is not a given. You might need some kind of super-user account. With these restrictions in mind, it seems logical that cross-platform tools do not bother.

MSalters
But there are plenty of devices where we can change the resolution (with or without super user rights). And some function can return boolean result for this ability. :)
macropas