问题描述
看,我正在为我的计算机项目制作一个游戏(在XNA 4中)。所以,我在家做编程并在学校的学校计算机上进行测试。我在游戏中的许多点放置了几个对象。示例一些在vector2(500,300),(700,1000)等。所有这些项目完全适合我的家用电脑的屏幕。但我注意到我学校的电脑屏幕较小,所以有些物体没有出现在学校的屏幕上。如何我可以在所有屏幕尺寸上正确准确地显示所有对象吗?请帮助,。
See,I'm making a game for my computer project(in XNA 4).So,I do the programming at home and test it on the school computer in school.I placed several objects at many points in my game for example some at vector2(500,300),(700,1000) etc.All these items fit perfectly on my home computer's screen.But I noticed the the computer screen in my school is smaller so some objects do not appear in the school screen.How can I display all objects correctly and accurately on all screen sizes?Please help,.
推荐答案
int x = 700; // BAD!
int x = (WidthOfScreen * 700) / 1000; // Better!
int xPercent = 70;
int x = (widthOfScreen * xPercent) / 100; // Best!
"in my game,I have drawn maybe 400-500 objects.Will I have to adjust all of them?It will surely take a lot of time."
你绝对是我们希望找到一个通用解决方案,它将负责扩展你的Window(或任何XNA调用它的显示),以及其中的所有对象。我打赌可以找到。
我想你可能会在XNA程序员的论坛上得到一些帮助。 'DreamInCode似乎非常活跃。快速搜索出现了这个可能的资源:为PC创建独立分辨率:[]。
You absolutely will want to find a "general" solution that will take care of scaling your Window (or whatever XNA calls its display), and all the objects in it. I bet that can be found.
I think you probably can get some help on an XNA programmer's forum. 'DreamInCode seems to be a very active one. A quick search turned up this likely resource: "Creating Resolution Independence For PC:" [^].
这篇关于关于屏幕分辨率的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!