File:  [RetroPC.NET] / np2 / macosx / np2opening.cpp
Revision 1.1: download - view: text, annotated - select for diffs
Sat Nov 1 01:55:06 2003 JST (22 years ago) by tk800
Branches: MAIN
CVS tags: HEAD
Add Alert

/*
 *  np2opening.h
 *  np2
 *
 *  Created by tk800 on Fri Oct 31 2003.
 *
 */

#include <QuickTime/QuickTime.h>
#include "compiler.h"
#include "np2.h"
#include "np2opening.h"

void openingNP2(void) {
    Rect		srt;
    GrafPtr		port;
    CFURLRef	openingURL;
    char		buffer[1024];
    FSRef		fsr;
    FSSpec		fsc;
    PicHandle	pict;
    GraphicsImportComponent	gi;
    
    GetPort(&port);
    SetPortWindowPort(hWndMain);

    openingURL=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("nekop2"), CFSTR("bmp"), NULL);
    if (openingURL) {
        if (CFURLGetFSRef(openingURL, &fsr)) {
            FSPathMakeRef((const UInt8*)buffer, &fsr, NULL);
            FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL);
            if (!GetGraphicsImporterForFile(&fsc, &gi)) {
                if (!GraphicsImportGetNaturalBounds(gi, &srt)) {
                    OffsetRect( &srt, -srt.left, -srt.top);
                    GraphicsImportSetBoundsRect(gi, &srt);
                    GraphicsImportGetAsPicture(gi, &pict);
                    OffsetRect(&srt, (640-srt.right)/2, (400-srt.bottom)/2);
                    DrawPicture(pict,&srt);
                    QDFlushPortBuffer(GetWindowPort(hWndMain), NULL);
                    KillPicture(pict);
                }
                CloseComponent(gi);
            }
        }
        CFRelease(openingURL);
    }
    SetPort(port);
}

RetroPC.NET-CVS <cvs@retropc.net>