Do you know where:
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
Are actually defined?
Many people are getting them via the extern, but then when I go to link,
they’re not found. I’ve tried looking for a CPS.h or what lib/framework that
might be in without much luck. Any help would be greatly appreciated.
CaseyOn 2/23/06, Ulrich von Zadow wrote:
skaller wrote:
Let me re-phrase… it’s completely optional, assuming you do all
the necessary platform specific setup yourself (see SDLmain for
details).And how would we know what that is? That’s an implementation
detail application programmers should not need to know about.I would like to know whether SDL can be used as a library
or not.At the moment it seems like the answer is YES on Linux
and Windows and NO on OSX.I can confirm that for Linux and OS X.
I would like to see this fixed – IF it is possible of course.
‘Fixed’ would imply that this is a bug, which it isn’t, since it’s clearly
documented. However, moving some of the initialization code from sdl’s
main to
SDL_Init on OS X would certainly improve the usability of SDL on this
plattform.Anyway, the magic incantations under OS X are:
#import <SDL/SDL.h>
#import “SDLMain.h”#import <Cocoa/Cocoa.h>
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn,
UInt32
_arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);void CustomSDLMain()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[ NSApplication sharedApplication ];
[ NSApp setMainMenu:[[NSMenu alloc] init] ];{ CPSProcessSerNum PSN; /* Tell the dock about us */ if (!CPSGetCurrentProcess(&PSN)) if
(!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
}Call CustomSDLMain before your first call to SDL.