[Xna]全屏搞砸了画画? [英] [Xna] Going fullscreen messes up drawing?

查看:92
本文介绍了[Xna]全屏搞砸了画画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Codeproject,



我创建了一个Minecraft 2D Clone。

我通过屏幕大小绘制每个块(所以我可以找到屏幕的中间位置。

但是当我将屏幕更改为FullScreen时,它将中间点移动到屏幕左侧,有没有办法解决这个问题?



这是我的代码:

Hello Codeproject,

I'm created a Minecraft 2D Clone.
I draw every block via the screen size(So I can find the middle of the screen).
But when I change the screen to 'FullScreen' it moves the middle point to the left of the screen, is there any way to fix this?

Here is my code:

/* Screen size and optionals. */
GraphicsManager.PreferredBackBufferWidth = 1024;
GraphicsManager.PreferredBackBufferHeight = 576;
GraphicsManager.IsFullScreen = true;







这就是改变中间点的意思:

http:// i40 .tinypic.com / ifaf12.png [ ^ ]



那么,屏幕拉伸会不会像你通过使用位图并在整个屏幕上拉伸一样(显然指出)如果它不是全屏,PrefferedBackBufferSize就会改变,或者它是。




And here is what I mean by changing the middle point:
http://i40.tinypic.com/ifaf12.png[^]

So, would there be any way that the screen "Stretches" just like you would do by using a bitmap and stretching it over the full screen(As obviously pointed out by the picture, the PrefferedBackBufferSize changes if it's not full screen, or it is.

推荐答案

经过几个小时的谷歌搜索,我遇到了我应该使用的代码,就是这样:



After a few hours of Googling I came across the code I should have used, and that is this:

/* Set the screen's size(Width and height) to the chunk width and height. */
GraphicsManager.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
GraphicsManager.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
GraphicsManager.IsFullScreen = true;





我也做了块大小有点大,现在它覆盖了整个屏幕。



I also made the chunk sizes a bit bigger so now it covers the whole screen.


这篇关于[Xna]全屏搞砸了画画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆