Two unrelated 2D game development questions

Started by
-1 comments, last by TheSilverHammer 16 years, 7 months ago
I am writing this game using DirectX 9 in C#. I have two questions. Question 1: My game, in it's current form, is in a window. The way things are setup, all the 2D sprites are of fixed size. This means if the window is shrunk, it simply hides part of display. I want to change this so that it shrinks the display. IE: Everything scales down so the entire 'view' is still there, just smaller. At first I was thinking I would have to go through each sprite and apply some kind of global scaling, but then I thought that was probably a really stupid way to do it. I am betting there is some kind of global matrix that is applied to everything I can set. This would solve two problems: The first being a shrinking window (or growing one) would still display 100% of the game. The second being, I could 'calibrate' my game for 800 x 600 (or some other resolution) and then just apply a scale factor to match the real resolution. For example, I could just say, I want the HUD health bar to be from 200, 20 to 300, 20 on an 800x600 screen, and then it would automatically end up in the right relative spot even if you switched to 1920 x 1200. I just need to know how to set the global matrix that will scale everything for me. Question 2: When designing a game with a HUD and I am relegating my play area to certain section, should I use multiple view ports or should I just stick with one? For example, on the 800x600 screen, if the 'action' area of the game goes from 0,0 to 600x600 and the HUD is in area 600,0 to 800,600, should I use two view ports or just one? I am thinking I should just use one, but then manually bound various sprites, such as bullets. IE: When a bullet's x coordinate is > 600, then do not draw it.

This topic is closed to new replies.

Advertisement