4

I am creating a game using C#, GDI+ and Raster images (2D images). For performance sake, I believe that I should have the game change the user's resolution to 800 x 600 and run the game in that setting. However, the graphics look distorted in a wide screen since the aspect ratio for 800 x 600 is different than from a wide screen. I cannot figure out how to determine the aspect ratio.

How is game programming normally handled on different resolutions? Should I even change the user's resolution? If I dont change the resolution, the game slows down a lot.

Also, some wide screens will "maintain the aspect ratio" when changing the resolution to 800 x 600 (thus creating black bars on the right and left) and some wide screens will fill up the entire screen. How do people handle that situation??

CRobinson
  • 41
  • 2
  • Why deal with this performance hit? Any reason you considered and rejected XNA? – Jonathan Dickinson Oct 31 '11 at 11:44
  • I already got into GDI+ before I heard about XNA. The game is half way built. Is XNA that much better? Is there not perf hit to XNA? I don't know much about it. ------ I continued looking around. I think ppl either use a 800 x 600 aspect ratio if the screen is regular, otherwise they use 1280 x 720 for wide screen. – CRobinson Oct 31 '11 at 12:02
  • 3
    Don't forget about 5/4 screens and others. You will need some general solution. – Kromster Oct 31 '11 at 12:19
  • @CRobinson XNA is hardware accelerated - you should really put some research into it, and it is 10x faster to make something in it compared to GDI+ (once you learn it) - especially for 2D games. – Jonathan Dickinson Oct 31 '11 at 12:22
  • @CRobinson e.g. I am running at 1920x1080 with (essentially) a 4096x4096 texture with 200 dynamic 2D lights and 1500+ particles at 700FPS on a GTX260. You won't come close to that with GDI+. – Jonathan Dickinson Oct 31 '11 at 12:25
  • @Jonathan: You could just edit your previous comment to add these infos ;) – Kromster Oct 31 '11 at 12:27
  • @JonathanDickinson I came from the GDI+ world myself and have since moved to XNA. XNA is way more than 10x more powerful than GDI+, even for 2D stuff, I'd say closer to 100x. CRobinson, I would highly recommend taking the plunge. I found it to be a really simple transition. It took me all of 10 minutes to get a sprite drawing the way I was used to in GDI/GDI+ (not even a hyperbole, ten minutes). – John McDonald Oct 31 '11 at 14:05
  • 3
    Why not just add a black border instead of changing the resolution. Movies get away with this all the time. – Tili Oct 31 '11 at 15:28

1 Answers1

3

In your current situation I would advice to get device resolution that is most similar to your planned resolution or slightly bigger than it (800x600 -> 1024x720) and deal with it manually. Add black areas on sides or some artistic patterns that complement your game.

As already said GDI+ is not a common approach to 2D game nowadays, but the general principle of dealing with various screen aspects still stands.

Kromster
  • 10,643
  • 4
  • 53
  • 67
  • Thanks for all the advice. I'm pretty new to this. What are some good books on XNA? Probably a stupid question, but is XNA backwards compatible to Windows XP? – CRobinson Oct 31 '11 at 12:51
  • That question I can't answer here. I'm more of an OpenGL guy. – Kromster Oct 31 '11 at 12:58
  • ... I should add that although I'm new to game programming, I'm not new to programming. I did application development for 12 years. So I wouldn't need a book that's too basic. – CRobinson Oct 31 '11 at 13:06
  • Take a look at this question: http://gamedev.stackexchange.com/questions/19141/what-is-the-best-way-to-get-started-with-xna – Kromster Oct 31 '11 at 13:12