|
|
| version 1.2, 2003/11/03 10:19:43 | version 1.5, 2004/01/11 16:58:47 |
|---|---|
| Line 38 PicHandle getBMPfromPath(char* path, Rec | Line 38 PicHandle getBMPfromPath(char* path, Rec |
| return(getbmp(fsc, srt)); | return(getbmp(fsc, srt)); |
| } | } |
| PicHandle getBMPfromResource(const char* name, Rect* srt) { | 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), CFSTR("bmp"), 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 74 void openingNP2(void) { |
| GrafPtr port; | GrafPtr port; |
| PicHandle pict = NULL; | PicHandle pict = NULL; |
| pict = getBMPfromResource("nekop2", &srt); | pict = getBMPfromResource("nekop2.bmp", &srt); |
| if (pict) { | if (pict) { |
| GetPort(&port); | GetPort(&port); |
| SetPortWindowPort(hWndMain); | SetPortWindowPort(hWndMain); |