Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Hello!

I am creating a 2D farming game using XNA - just today I have tried applying full screen to it, and I realized I failed badly with something. It cuts off a bit of the lower part [item hotbat and a piece of character status area]

I have just started learning C# and XNA, I just totally rewrote the engine and changing everything with rendering all over again is not an option - honestly I have no idea myself how does it all work anymore [I'm using some crazy camera class thing with an array of rectangles for displaying tiles / moving them around when the player moves etc] :-P

In the previous version of the engine I used the default XNA window size and the full screen worked just fine, this time I changed it to something more ... comfortable, and it does not work anymore. Changing the preferred buffer width does nothing at all in fullscreen, it's still cut off, and still the same height. I have no idea what matrices or viewports are, and everything I seem to find on google refers to them and some crazy complicated stuff

Here is a screen demonstrating how does it look while in fullscreen

The screen size I am using is 800 x 640 My screen is very long sideways [whatever the name for such screens was :|]

Is there a way to fix that without rewritting everything?

share|improve this question
    
Have you tried setting the screen size to 800x600 instead? 800x640 is not a standard monitor resolution. –  Jon Feb 9 '13 at 21:41
    
Yes, I just did that as a temporary fix - I kind of kept adding 32 [the tile size] and reached 640 somehow, I was pretty sure it would be a good, healthy number... :| To be honest I have not a slighest idea about resolutions - all I know it's good to have healthy, even numbers, I was using multiples of 32 so I can just place tiles like "x: 13*32, y: 9*32" instead of giving exact value for each of them - I'm still a newbie here, my tile rendering thing would probably make you laugh - it's pretty much impossible to do anything more than just simply display the map with them [like rotate/resize] –  user26129 Feb 9 '13 at 22:18
    
Also, it cut off one row of tiles at the bottom, so now it's drawing two rows that are not visible [that's one useless row of tiles that does nothing at all just eats up precious memory, and one that's needed for the screen to move the rendered area around with the player] so if it stays like that [800x600] I'll have to put a lot of changes to all the displaying/update code, is there not any other, moderately easy way of fixing it? –  user26129 Feb 9 '13 at 22:25
    
Usually more code is a bad solution to not understanding your code. :p –  Anko Feb 9 '13 at 23:12
    
It's changing your internal resolution; do you take this into account when you draw or are you just using a pre-computed value? –  Vaughan Hilts Feb 10 '13 at 2:03
show 2 more comments

1 Answer

Without getting into discussions about matrices and viewports etc, it looks more than likely that your sprites and tiles are being drawn just fine, but at positions that are outside of your fullscreen size.

Something like this in your main class should be there first:

graphics.PreferredBackBufferWidth = 800;
graphics.PreferredBackBufferHeight = 640;
graphics.IsFullScreen = true;

Just to be sure you are setting the width and height for the fullscreen mode resolution. Then, you might want to look at reducing the x and y position of the lower hotbar by 1. This should move the hotbar one position towards top left in both axes.

Its hard to tell what else is missing from the lower part of the screenshot.

share|improve this answer
    
One row of tiles [not much of a loss, but it was nice to have the character exactly in the middle on the screen], half of the future player status window [which can be moved too], and yes I do have that graphic things –  user26129 Feb 14 '13 at 10:34
    
To place things on the screen properly, would require discussion about viewports I think. –  Jason Coombes Feb 14 '13 at 11:29
    
Isn't there a simple function like rectangle that would work like a viewport? Where I just define width and height, and the position? –  user26129 Feb 14 '13 at 20:54
    
No. We would need to look at how a viewport can be used with detection of the screenwidth and screenheight, and determine where the outer bounds of the screen are, which is also a method call that could be used. If it wont confuse you, I would be able to post an example of this. –  Jason Coombes Feb 15 '13 at 7:40
    
Sure, it would be appreaciated. :) –  user26129 Feb 15 '13 at 11:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.