跨平台更改屏幕分辨率的方法
有没有跨平台的方法(Windows、Linux、MacOSX)来更改屏幕分辨率? Java 和 .Net-Mono 都无法做到这一点。 只能通过本机 API 调用。 这是非常奇怪的情况:有明确的(托管)方法来获取屏幕分辨率,但缺少设置方法。 这个功能很危险或者很复杂吗? 其他跨平台系统(Parrot、RealBasic 等)是否可以执行此操作?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不确定您是否使用 libSDL,但请查看:http:// /docs.huihoo.com/sdl/1.2/sdlsetvideomode.html
PS 哦,顺便说一句,如果您还不知道的话,LibSDL 是一个主要用于游戏的跨平台库。 http://www.libsdl.org/
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/
实际上 - 设置屏幕分辨率取决于 OS/X 服务器。 如果您确实需要它,您应该考虑它,然后,如果您确实需要它,您应该使用特定于操作系统的实现来编写某种抽象层。 设置测试环境(尤其是不同的 Linux 风格)将是地狱!
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!
嗯,这确实取决于平台(win32、Mac OS X、Linux 的做法都不同[不同的显示驱动程序])。 您可能应该首先问自己为什么需要更改屏幕分辨率。
您可以轻松地以较低的屏幕分辨率渲染您拥有的任何内容,然后缩放以适合(填充)屏幕,而不是更改分辨率。 这是同一件事。
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.
这是一个好问题。 我不知道有任何跨平台系统可以做到这一点。 我曾经开发过一个自动更改屏幕分辨率的应用程序,如果我必须重来一次,我就不会那样设计。 改变分辨率对用户来说是一种干扰——有点像移动脚下的地面。 液晶显示器具有迄今为止看起来最好的“自然”分辨率。 如果你改变它,用户可能会非常恼火。
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.
有很多设备无法更改分辨率。 手机,例如*其中一些运行 Mac OSX 或 Linux)。 但即使在台式机上,更改分辨率的能力也不是给定的。 您可能需要某种超级用户帐户。 考虑到这些限制,跨平台工具不会打扰似乎是合乎逻辑的。
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.