Previous Book Contents Book Index Next

Inside Macintosh: Apple Game Sprockets Guide /
Chapter 2 - DrawSprocket / DrawSprocket Reference
DrawSprocket Functions / Choosing a Context and Saving Preferences


DSpContext_Restore

You can use the DSpContext_Restore function to restore a context that was saved previously, most likely to preserve a user's preferences.

OSStatus DSpContext_Restore (
void *inFlatContext,
DSpContextReference *outRestoredContext);
inFlatContext
A pointer to the flattened context.
DSpContextReference
On exit, a reference to the restored context.
function result
A result code.
DESCRIPTION
The DSpContext_Restore function takes, in the inFlatContext parameter, a pointer to a flattened context. Typically, the flat context would have been saved out to disk and reloaded on a later execution of the game before calling this function. When you call this function, DrawSprocket attempts to find a context that matches the flattened context in the current system and returns, in the DSpContextReference parameter, a reference to the context it finds.

If it can't find a match, the user probably has reconfigured the displays since the last time your game was run, and DSpContext_Restore returns an error. This function has a high probability of failing, so your game should not rely on being able to restore the context. However, the game should attempt to do so as part of the normal saving of the user preferences.

If you save a context, flatten it before you first make the context's play state active; otherwise, the saved data will not contain the proper information with which to locate the display.

CALLING RESTRICTIONS
Do not call this function during an interrupt.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996