|
|
| version 1.3, 2003/11/11 16:33:50 | version 1.6, 2004/03/02 23:23:06 |
|---|---|
| Line 12 | Line 12 |
| #include "np2opening.h" | #include "np2opening.h" |
| static PicHandle getbmp(FSSpec fsc, Rect* srt) { | static PicHandle getbmp(FSSpec fsc, Rect* srt) { |
| PicHandle pict = NULL; | PicHandle pict = NULL; |
| GraphicsImportComponent gi; | GraphicsImportComponent gi; |
| Line 38 PicHandle getBMPfromPath(char* path, Rec | Line 37 PicHandle getBMPfromPath(char* path, Rec |
| return(getbmp(fsc, srt)); | return(getbmp(fsc, srt)); |
| } | } |
| PicHandle getBMPfromResource(const char* name, Rect* srt, const CFStringRef type) { | bool getResourceFile(const char* name, FSSpec* fsc) { |
| CFURLRef url = NULL; | CFURLRef url = NULL; |
| FSRef fsr; | FSRef fsr; |
| FSSpec fsc; | bool ret = false; |
| PicHandle pict = NULL; | CFStringRef str = CFSTRj(name); |
| url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTRj(name), type, NULL); | if (!str) return (false); |
| url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), str, NULL, NULL); | |
| CFRelease(str); | |
| if (url) { | if (url) { |
| if (CFURLGetFSRef(url, &fsr)) { | if (CFURLGetFSRef(url, &fsr)) { |
| FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL); | if (FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, fsc, NULL) == noErr) { |
| pict = getbmp(fsc, srt); | ret = true; |
| } | |
| } | } |
| CFRelease(url); | CFRelease(url); |
| } | } |
| return(ret); | |
| } | |
| PicHandle getBMPfromResource(const char* name, Rect* srt) { | |
| FSSpec fsc; | |
| PicHandle pict = NULL; | |
| if (getResourceFile(name, &fsc)) { | |
| pict = getbmp(fsc, srt); | |
| } | |
| return(pict); | return(pict); |
| } | } |
| Line 60 void openingNP2(void) { | Line 73 void openingNP2(void) { |
| GrafPtr port; | GrafPtr port; |
| PicHandle pict = NULL; | PicHandle pict = NULL; |
| pict = getBMPfromResource("nekop2", &srt, CFSTR("bmp")); | pict = getBMPfromResource("nekop2.bmp", &srt); |
| if (pict) { | if (pict) { |
| GetPort(&port); | GetPort(&port); |
| SetPortWindowPort(hWndMain); | SetPortWindowPort(hWndMain); |