PDA

View Full Version : okay this one should be easier...




dave.h
May 17, 2005, 04:26 PM
I have my game working in windowed mode for the time being, and want to know how to

1) change the screen resolution and bit depth
2) ideally, create a custom 16-bit color array
3) apply the current subclass of NSImageView to the full-screen window.

I know options 1 and 3 must be pretty easy, so.... hopefully somebody can help...



robbieduncan
May 18, 2005, 05:35 AM
Full Screen Tutorial (http://cocoadevcentral.com/articles/000028.php)

With reference to 3 it's no different that doing it in windowed mode. I would create a custom NSView and draw into that.

dave.h
May 19, 2005, 12:14 PM
hmm, well:

Using the tutorial you provided, I've figured out how to get the game into full screen mode. That is to say, put up a window covering the whole screen, thereby hiding the menu bar.

However, when I do this, my frame rate drops from a Nice even 60 down to 30 or even 20... Now, my code is in no way optimized - I'm redrawing the entire View on each frame update, mostly in anticipation of heavy background redrawing, scaling and sprite scaling.

To keep my frame rate at 60, my plan has been to use an 800x600 graphics context on computers as slow as mine (1.25 ghz), but I also have a 1280x960 sprite set from my original Adobe Illustrator exports.

Now that I'm pressed with the issue of running full screen, it seems to me that Quartz doesn't support changing of screen resolution, but I'm reluctant to use OpenGL for a sprite-based game -- and honestly, I find OpenGL somewhat confusing, and I can't get glDrawPixels to work properly. (ie, nothing is drawn) However, CGLayers aren't available until tiger, which seem to be exactly what I need for high speed 2d animation. I'll be getting tiger soon.. Should I just wait for CGLayers? If so, is it POSSIBLE to change to the 800x600 resolution WITHOUT OpenGL? That is, with Quartz??

I'd like as much input as possible, thanx :cool:

robbieduncan
May 20, 2005, 03:58 AM
Quartz is not designed for what you are trying to do :( It is designed from the ground up to be resolution independant and as much as possible Vector based. You can change the screen resolution through some Core Graphics calls (I think) or Quicktime.

To acheive what you want and attain decent preformance you could try this: Do all your drawing into an 800x600 NSImage. The scale the final image to fit the screen. Whilst this is not free it is probably faster that scaling everything you draw. For faster (scaled) sprite drawing you can turn down the quality and scaling quality in Core graphics.

whooleytoo
May 20, 2005, 10:45 AM
You can use the QuickTime call BeginFullScreen() to check for available resolutions and switch to them.