Best way to switch screen res?
Hi
What is the best way to switch screen res for a game that does not use opengl?
Im using CoreGraphics right now....
Which moves the users windows a round.
Other ideas?
What is the best way to switch screen res for a game that does not use opengl?
Im using CoreGraphics right now....
Which moves the users windows a round.
Other ideas?
Always capture the display before changing resolution.
Quote:Originally posted by OneSadCookie
Always capture the display before changing resolution.
And how would one go about this?
AKA... what API etc am I looking for?
Had you downloaded the source, you would have known it by now. 

Code:
void SwitchMainDisplayResolution()
{
CGDisplayCapture( kCGDirectMainDisplay );
//----------------------------------------------------------------------
// Try to switch to a display mode with resolution 640 x 480,
// depth 32 bpp, and refresh rate 60 hertz:
CFDictionaryRef displayMode;
//----------------------------------------------------------------------
displayMode = CGDisplayBestModeForParametersAndRefreshRate(
kCGDirectMainDisplay,
32,
640, 480,
60,
NULL
);
//----------------------------------------------------------------------
CGDisplaySwitchToMode( kCGDirectMainDisplay, displayMode );
//----------------------------------------------------------------------
CGDisplayRelease ( kCGDirectMainDisplay );
}Quote:Originally posted by FCCovett
Had you downloaded the source, you would have known it by now.
You mean...
If I had bothered to actually look at the source

Had not the time yet...
On phone with apple trying to get a iBook fixed. ugg
Any how thanks much... will try this tonight.
There is a problem on Panther with capturing a single display (search mac-opengl and/or mac-games-dev for the thread).
I've always used CGCaptureAllDisplays anyway -- I think it's a better user experience.
I've always used CGCaptureAllDisplays anyway -- I think it's a better user experience.
Yeah, and it STILL doesn't work right 100% of the time with multiple monitors. Grrrrr...
Alternatively, check out ModeWhacker. I modified the main like this to capture the displays. It leaves your windows alone!
-Jon
-Jon
Code:
int
main(int argc, const char *argv[])
{
CGDirectDisplayID display[kMaxDisplays];
CGDisplayCount numDisplays;
CGDisplayCount i;
CGDisplayErr err;
err = CGGetActiveDisplayList(kMaxDisplays,
display,
&numDisplays);
if ( err != CGDisplayNoErr )
{
printf("Cannot get displays (%d)\n", err);
exit( 1 );
}
printf( "%d displays found\n", (int)numDisplays );
err = CGCaptureAllDisplays();
if ( err != CGDisplayNoErr )
{
printf("Cannot capture all displays (%d)\n", err);
exit( 1 );
}
for ( i = 0; i < numDisplays; ++i )
{
modewhacker(display[i]);
}
err = CGReleaseAllDisplays();
if ( err != CGDisplayNoErr )
{
printf("Cannot release all displays (%d)\n", err);
exit( 1 );
}
exit(0);
}Quote:Originally posted by FCCovett
Check out the source from this thread (make sure to use the most recent link - the web-site with the source has moved):
http://www.idevgames.com/forum/showthrea...#post51277
I tried that out, and I uncommented all the screen changing stuff from your main to try that out. It didn't work. (Windows got resized and for some reason the menu bar in Xcode got screwed up and I had to relaunch Xcode) If you plan on updating MyGame, I'd suggest putting in a Fullscreen menu option.
-Jon
Quote:Originally posted by aarkuIt works perfectly so far! You get a star!
Alternatively, check out ModeWhacker. I modified the main like this to capture the displays. It leaves your windows alone!
-Jon
I'm still skeptical though... I just KNOW I'll find more junk if I beat it up enough.

Thank you.
Modewhacker
Ah perfect I never noticed the screen capture part of that app.
I think my code was based on it
Ah perfect I never noticed the screen capture part of that app.
I think my code was based on it
Ok another issue
calling CGCaptureAllDisplays();
Works fine.
Except that none of my previouse window code seems to work at all... windows do not draw etc...
or in this case dialogs read from res files.
Any thought?
Do I need to some how bless the current window.
Im looking through code and not noticing anything.
calling CGCaptureAllDisplays();
Works fine.
Except that none of my previouse window code seems to work at all... windows do not draw etc...
or in this case dialogs read from res files.
Any thought?
Do I need to some how bless the current window.
Im looking through code and not noticing anything.
Okay, after all these years of programming on Macs since system 7, I'm going to just blow a gasket on this one. ENOUGH!!! This screen/pixel/capturing/context/port thing has gone on long enough! When will they (Apple) put somebody in the seat that can make it simple and straight-forward? Why do we constantly have to fight with this? I can't possibly count the number of different hoops I've had to jump through with every single fudsing release FOR THIRTEEN YEARS to get this simple task accomplished! End gasket blowing. Sorry.
Should we start a petition?
Should we start a petition?
Quote:Originally posted by AnotherJake
Okay, after all these years of programming on Macs since system 7, I'm going to just blow a gasket on this one. ENOUGH!!! This screen/pixel/capturing/context/port thing has gone on long enough! When will they (Apple) put somebody in the seat that can make it simple and straight-forward? Why do we constantly have to fight with this? I can't possibly count the number of different hoops I've had to jump through with every single fudsing release FOR THIRTEEN YEARS to get this simple task accomplished! End gasket blowing. Sorry.
Should we start a petition?
No No it is perfectly fine to feel that way...
Im on liek 10+ years of mac game programming and damn if that was not always one of the biggest pain in the ass issues I ever had to deal with on the mac :-)
So I feel your pain...
Quote:Originally posted by ChrisD
Except that none of my previouse window code seems to work at all... windows do not draw etc...
or in this case dialogs read from res files.
They're drawing just fine, they're just _under_ the CoreGraphics blanking window.
I hacked around this in a REALBasic plugin: <http://webhome.idirect.com/~frankco/rb/d..._v10b1.sit> full source is included (it's CFM Carbon but will work in Macho as-is - just ignore the runtime glue). One problem I haven't been able to solve is that Carbon has no concept "menu" windows, so they still draw under the blanking window (if you can avoid popup menus in your GUI you should be fine, otherwise you might need to use Cocoa).
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL full screen mode leaves garbage on screen when exiting app | Malarkey | 5 | 4,495 |
Nov 19, 2008 12:51 PM Last Post: Malarkey |
|
| Fullscreen/resolution switch causes texture loss | IBethune | 4 | 3,568 |
Feb 21, 2008 01:37 PM Last Post: OneSadCookie |
|
| fullscreen-window mode switch | NYGhost | 10 | 4,808 |
Feb 10, 2005 09:52 AM Last Post: NYGhost |
|
| Switch Between Fullscreen and Windowed Modes - Again... | thaeez | 2 | 2,687 |
Jul 9, 2004 02:49 AM Last Post: thaeez |
|
| OpenGL CGL Switch Between Fullscreen and Windowed Mode | thaeez | 1 | 3,024 |
Jun 30, 2004 04:29 AM Last Post: OneSadCookie |
|

