RezLib on OSX

Member
Posts: 351
Joined: 2002.04
Post: #1
The last thing I need to get working in my Snowboarding game before I announce a beta version is resolution switching. I'm using RezLib to do this and under OS9 it works fine but under OSX it gives me this error:

rlDirectDisplayAPINotAvailable

About which the docs say:

"RezLib could not run because the DirectDisplay API could not be loaded. The
CoreGraphics framework may not be installed or may be installed in the wrong place. Should only affect MacOS X and later systems."

Does anyone know how I could check if the CoreGraphics framework is installed properly?

Or does anyone know another reason I might be getting this error? I've never done anything but a standard install of OSX so maybe something else is causing it?
Quote this message in a reply
Tobi
Unregistered
 
Post: #2
I can't help you with your RezLib problem, but here's an alternative for the resolution switching under OS X:
Code:
CGDirectDisplayID    dispID;
int bitDepth=16;
int width=640;
int height=480;

CGGetActiveDisplayList(1, &dispID, NULL);
CGDisplaySwitchToMode(dispID, CGDisplayBestModeForParameters(dispID, bitDepth, width, height, NULL));
This stuff is inside the CoreGraphics framework which is in the Application Services framework.

Good luck,

-Tobi
Quote this message in a reply
Member
Posts: 351
Joined: 2002.04
Post: #3
Thanks for that Tobi, but my game is Carbon, and that code is OSX only. That's why RezLib is so useful, because it handles res switching on both 9 and X.

Maybe I should ask on the mac-game-dev list instead, Ian Ollman often responds there, and it is his library.
Quote this message in a reply
Tobi
Unregistered
 
Post: #4
That's not a problem. These functions are Carbon APIs. If you compiling with at least CW 6 they should work. In Project Builder it's no problem at all, but you can't compile programs that run under Classic so I guess you use some sort of CodeWarrior.
I guess you are compiling 2 different binaries: One for OS X (using Carbon) and one for Mac OS Classic.
But if you put everything into one binary, you could do a check if you run on OS X and switch the screen with these functions, and otherwise with RezLib. Just like this:

Code:
void ChangeScreenRes(int bitDepth, int width, int height)
{
#ifdef __APPLE_CC__
//Running on OS X

CGDirectDisplayID    dispID;

CGGetActiveDisplayList(1, &dispID, NULL);
CGDisplaySwitchToMode(dispID, CGDisplayBestModeForParameters(dispID, bitDepth, width, height, NULL));
#else
DoTheChangeWithRezLib(bitDepth, width, height);
#endif
}

Code should work, try it out.
Quote this message in a reply
Member
Posts: 351
Joined: 2002.04
Post: #5
I'm compiling one Carbon program using MPW on OS9. The reason I thought those functions were OSX only is because the header file which contains them says they are not available under Carbon, only OSX?
Quote this message in a reply
Member
Posts: 351
Joined: 2002.04
Post: #6
I now have my answer to this question, it seems I was using a very old version of RezLib and everything works fine with the latest version.

Thanks for the help anyway Tobi.
Quote this message in a reply
Post Reply