Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
C#
/* Screen size and optionals. */
GraphicsManager.PreferredBackBufferWidth = 1024;
GraphicsManager.PreferredBackBufferHeight = 576;
GraphicsManager.IsFullScreen = true;



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.
Posted

1 solution

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

C#
/* 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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900