Widesreen monitors and res switching

Member
Posts: 50
Joined: 2002.12
Post: #1
Ok, my game switches the resolution to 800 X 600, which is cool except when played on a widescreen monitor (ie apple cinema display, 17" imac) I've seen games that have "bars" on the side so that the game screen isn't streched. My question is, how do they do that? I'm using DrawSprocket for res switching.

-Justin
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Make sure you don't get a mode labeled "stretched".

(I only know how to find out in CGDirectDisplay).
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #3
If you use DSpGetFirstContext() and DSpGetNextContext() you can retrieve a list of all possible resolutions for a given display. If you scan the list you'll notice that some of them are full width and some aren't - just choose one that has the aspect ratio you're looking for. I recommend you try to adjust your game's display to account for wide aspect displays instead of forcing the display into 800x600, if you can. If you can't, you could just draw into an 800x600 rectangle centred on the display (which would give the effect you're looking for).

You could also use the information from those functions to build a menu from which the user can choose their preferred resolution and refresh frequency. It's a nice touch, and it helps you to avoid making incorrect assumptions about their display's capabilities.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #4
Hmmm, ok thanks.
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #5
So if I want to draw into a 800 X 600 box, I should get a display that is 600 pixels high and whatever wide? Then just make a window 800 x 600 and center it.
Quote this message in a reply
macboy
Unregistered
 
Post: #6
Not necessarily a window, just make your game go completely fullscreen, but only put the game in the middle 800x600.
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #7
Right, but I'm gonna use a window. I think my problem was that I was forcing widesreen displays into the 800 x 600 so that would stretch it. If I don't constrain the width it will have the right resolution for the monitor at 600 pixels high.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #8
Whatever you decide to do with your game content, you should be aware that there are at least _four_ aspect ratios out there in Apple's displays:

4x3 (old CRTs, iBooks)
3x2 (15" Powerbooks)
16x10 (Cinema displays, 17" PowerBooks, new iMacs)
5x4 (the 17" Studio display)

These are the aspect ratios of the physical displays. You can get some other ones depending on the resolutions available on the video card.



My inclination is to change my game's playfield to an area appropriate to the display. That might not work for your game though.

Also, some users have strong preferences for either letterbox matting or stretching content to fill the screen. I use the aspect ratio and stretching mode of the current display when I enter full screen mode. Or you could explicitly ask the user what they want, via a menu of resolutions.
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #9
Well, the only screen I'd want to letter box would be the cinema or 16x10 one. The other ones should look fine to stretch it. My game can't change the playfield size, I need it to be 800 x 600. If there is a way to check for a cinema display, then I'd know which to letter box.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #10
Quote:Originally posted by jSTIN
Right, but I'm gonna use a window

Windows and DrawSprocket don't really go together. If you try to put a window up while using DrawSprocket on Mac OS X, it'll end up invisible because DrawSprocket's blanking window will obscure it. I believe you can hack around this by moving your window into a different layer, but you might find it easier to just draw into DrawSprocket's back buffer, obtained by calling DSpContext_GetBackBuffer().

Quote:Well, the only screen I'd want to letter box would be the cinema or 16x10 one. The other ones should look fine to stretch it.

I think the widescreen format is the only one that can be stretched!

Quote:My game can't change the playfield size, I need it to be 800 x 600.

Why is that? Do you have a bunch of fixed size backgrounds or something?

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #11
Quote:Windows and DrawSprocket don't really go together. If you try to put a window up while using DrawSprocket on Mac OS X, it'll end up invisible because DrawSprocket's blanking window will obscure it. I believe you can hack around this by moving your window into a different layer, but you might find it easier to just draw into DrawSprocket's back buffer, obtained by calling DSpContext_GetBackBuffer().


I've used windows with DrawSprocket for years. I don't really think it ever shows up though Rolleyes

Quote:I think the widescreen format is the only one that can be stretched!


So your saying that on all the other displays if I pass 600 for the height and leave the width NULL or whatever it will get a display that is 800 X 600?

Yeah, I have some fixed size backgrounds, and the playfield heavily relies on the pixels positions.

Now I am trying this, I'm only passing the height I want, which is 600, and leaving the width blank. On my computer it is getting an 800 x 600 resolution. I hope that on all other monitors except the cinema it will do the same. With the 17" studio display, which is almost square, if it doesn't get an 800 x 600 (which I think would squash it) some of the game will be draw offscreen.
Quote this message in a reply
Member
Posts: 57
Joined: 2002.04
Post: #12
Of course, if you look for screen modes with a height of 600, there's still a chance that you'll get 800 x 600; if there isn't a way to filter out stretched screen modes in DrawSprocket, I think the best choice would be to find all modes at 800 x 600 and let the user choose between them (unless there's only one). You might also want to note that some older displays use 832 x 624 instead of 800 x 600, so it might be good to check for that if you can't find anything at 800 x 600, or to add a compatibility mode that doesn't switch the resolution at all.
Quote this message in a reply
Member
Posts: 50
Joined: 2002.12
Post: #13
Well, I think the best thing to do would be to pass only 600 for the height. Then I'd check the width and see what it is. If it the two values have and ratio of 16 x 10 then I now it is widescreen. Otherwise I'll force it into 800 x 600. Hmm, I think the 15" powerbook might also need to be letter boxed.

Does anyone here have a display that isn't a "widescreen" (ie cinema or 17" imac) or a "common" (ie older imacs, emac aspect ratio 4 x 3) size display? I'd like to know how games behave on your computer. I'm mostly thinking of the 15" powerbook.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #14
Quote:Originally posted by jSTIN
I've used windows with DrawSprocket for years. I don't really think it ever shows up though Rolleyes

Eh? What doesn't show up? Your window? Huh

Quote:Well, I think the best thing to do would be to pass only 600 for the height. Then I'd check the width and see what it is. If it the two values have and ratio of 16 x 10 then I now it is widescreen. Otherwise I'll force it into 800 x 600. Hmm, I think the 15" powerbook might also need to be letter boxed.

Does that work (passing the height but not the width)?

If I were you, I'd ignore the whole idea of 16:10 displays being a problem and handle it in a more general way. If you accept any resolution larger than 800x600 and just use an 800x600 rectangle in the centre you'll cover every eventuality. Apart from not being able to tell the difference between stretched and non-stretched modes!

As Mazilurik said, your game might find itself running on a display that can't do 800x600 at all. I have an old display at the office that can only do 1024x768, for example. Future Macs (or monitors) might not work at 800x600 either (not likely, but not impossible). You can deal with this easily if you accept any oversize resolution.

BTW, I think you can determine whether a mode is stretched or not by querying the Display Manager directly. I'm not sure how you do that, though. I found Apple's Display Manager documentation pretty impenetrable.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Geppy
Unregistered
 
Post: #15
I have the 3x2 15in powerbook. Most games that use 800x600 either leave black bars on the sides by telling the hardware to use 800x600 not stretched OR they use a native non stretched resolution and simply draw more to the screen. I prefer the latter but usually if its a choice between having the black vertical bars or having distorted images i want the bars.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  switching screen resolution NelsonMandella 3 3,465 Apr 25, 2010 01:33 PM
Last Post: SethWillits
  Full Screen Switching Blacktiger 3 3,608 Feb 9, 2008 03:05 PM
Last Post: Blacktiger
  Trouble with fullscreen switching codeman9 14 5,594 Aug 11, 2004 01:37 PM
Last Post: arekkusu
  switching projection modes Muffinking 1 2,214 Aug 10, 2003 08:34 PM
Last Post: OneSadCookie