本文整理汇总了C++中FileSpecifier::GetSpec方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSpecifier::GetSpec方法的具体用法?C++ FileSpecifier::GetSpec怎么用?C++ FileSpecifier::GetSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSpecifier
的用法示例。
在下文中一共展示了FileSpecifier::GetSpec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_finishing_touches_to_save_file
void add_finishing_touches_to_save_file(FileSpecifier &File)
// FileDesc *file)
{
short refnum;
unsigned char name[64+1];
OSErr err;
FSSpec *SpecPtr = &File.GetSpec();
FInfo finder_info;
err = FSpGetFInfo((FSSpec *)SpecPtr, &finder_info);
if (err != noErr) return;
FSpCreateResFile(SpecPtr, finder_info.fdCreator, finder_info.fdType, smSystemScript);
if (ResError() != noErr) return;
/* Save the STR resource that tells us what our application name is. */
refnum= FSpOpenResFile(&File.GetSpec(), fsWrPerm);
// resource_file_ref= FSpOpenResFile((FSSpec *) file, fsWrPerm);
if (refnum < 0) return;
Handle resource;
/* Add in the overhead thumbnail. */
add_overhead_thumbnail(File);
/* Add the application name resource.. */
getpstr(name, strFILENAMES, filenameMARATHON_NAME);
// add_application_name_to_fsspec((FileDesc *) file, name);
// LP: copied out of files_macintosh.c -- add_application_name_to_fsspec();
// this is the only place that uses this code
/* Add in the application name */
err= PtrToHand(name, &resource, name[0]+1);
assert(!err && resource);
AddResource(resource, 'STR ', -16396, "\p");
ReleaseResource(resource);
CloseResFile(refnum);
// End copying
}
示例2: add_overhead_thumbnail
/* ------------ Local code */
static void add_overhead_thumbnail(
FileSpecifier &File)
{
PicHandle picture;
PicHandle preview;
RgnHandle clip_region;
FontInfo info;
short text_x, text_y;
short text_length;
Str255 temporary;
GWorldPtr old_gworld;
GDHandle old_device;
struct overhead_map_data overhead_data;
Rect bounds;
AEDesc aeFileSpec;
FSSpec *SpecPtr;
// Skip all this if there's no nav services to install the preview
if(!machine_has_nav_services() || NavLibraryVersion() < kNavServicesVersion_2_0)
return;
GetGWorld(&old_gworld, &old_device);
SetGWorld(world_pixels, (GDHandle) NULL);
// Note well. We're using world_pixels to create our thumbnail pict within.
// If world_pixels is runing as a postage stamp (low-res + small display space)
// Then it is actually smaller than the size we're looking to build a thumbnail
// within. But seeing as we're generating pict images and using drawing commands
// instead of bit-wise operations. It all works out.
/* Create the bounding rectangle */
SetRect(&bounds, 0, 0, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
/* Start recording.. */
picture= OpenPicture(&bounds);
PaintRect(&bounds);
overhead_data.scale= OVERHEAD_MAP_MINIMUM_SCALE;
overhead_data.origin.x= local_player->location.x;
overhead_data.origin.y= local_player->location.y;
overhead_data.half_width= RECTANGLE_WIDTH(&bounds)/2;
overhead_data.half_height= RECTANGLE_HEIGHT(&bounds)/2;
overhead_data.width= RECTANGLE_WIDTH(&bounds);
overhead_data.height= RECTANGLE_HEIGHT(&bounds);
overhead_data.mode= _rendering_saved_game_preview;
_render_overhead_map(&overhead_data);
RGBForeColor(&rgb_black);
PenSize(1, 1);
TextFont(0);
TextFace(normal);
TextSize(0);
ClosePicture();
// JTP: Add Nav Services style preview
SetRect(&bounds, 0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
preview= OpenPicture(&bounds);
SetRect(&bounds, PREVIEW_IMAGE_X, PREVIEW_IMAGE_Y,
THUMBNAIL_WIDTH + PREVIEW_IMAGE_X, THUMBNAIL_HEIGHT + PREVIEW_IMAGE_Y);
clip_region= NewRgn();
GetClip(clip_region);
ClipRect(&bounds);
DrawPicture(picture, &bounds);
SetClip(clip_region);
/* Center the text in the rectangle */
// LP: Classic doesn't have this function
#ifdef TARGET_API_MAC_CARBON
CopyCStringToPascal(static_world->level_name, temporary);
#else
strncpy((char *)temporary,static_world->level_name,LEVEL_NAME_LENGTH);
c2pstr((char *)temporary);
#endif
// LP: fix to allow lengths more than 127 bytes (not really necessary, but...)
text_length = *ptemporary;
TruncText(PREVIEW_WIDTH, (char *)temporary+1, &text_length, smTruncEnd);
*ptemporary = text_length;
GetFontInfo(&info);
text_y= PREVIEW_HEIGHT - info.descent;
text_x= PREVIEW_LABEL_X + (PREVIEW_WIDTH-StringWidth(temporary))/2;
MoveTo(text_x, text_y);
DrawString(temporary);
ClosePicture();
// This requires NavServices 2.0, what's the inline check?
// From FSS get a AEDesc
OSStatus err;
SpecPtr = &File.GetSpec();
err = AECreateDesc(typeFSS, SpecPtr, sizeof(FSSpec), &aeFileSpec);
HLock((Handle)preview);
err = NavCreatePreview(&aeFileSpec, 'PICT', *preview, GetHandleSize((Handle)preview));
HUnlock((Handle)preview);
//.........这里部分代码省略.........
示例3: LoadModel
// Load a QD3D model object:
TQ3Object LoadModel(FileSpecifier& Spec)
{
// First create a file object and a storage object,
// and associate the storage object with the file object.
// MacOS / FSSpec version:
// modify as necessary for Quesa and SDL --
// Quesa has similar calls with the MacOS FSSpec being replaced by a Windows file handle
// and a Unix file path
TQ3StorageObject StorageObject = Q3FSSpecStorage_New(&Spec.GetSpec());
if (!StorageObject) return NULL;
TQ3FileObject FileObject = Q3File_New();
if (!FileObject)
{
Q3Object_Dispose(StorageObject);
return NULL;
}
Q3File_SetStorage(FileObject, StorageObject);
Q3Object_Dispose(StorageObject);
// Read in the model object
if (Q3File_OpenRead(FileObject, NULL) != kQ3Success)
{
Q3Object_Dispose(FileObject);
return NULL;
}
// Create a group for holding all the read-in objects
TQ3Object ModelObject = Q3DisplayGroup_New();
if (!ModelObject)
{
Q3Object_Dispose(FileObject);
return NULL;
}
// All at once: slurp in now and process later
while (Q3File_IsEndOfFile(FileObject) == kQ3False)
{
// Grab an object from the file
TQ3Object MemberObject = Q3File_ReadObject(FileObject);
if (!MemberObject)
continue;
// Only interested in renderable objects (no hints or comments or ...)
if (Q3Object_IsDrawable(MemberObject))
Q3Group_AddObject(ModelObject, MemberObject);
// Clean up
if (MemberObject)
Q3Object_Dispose(MemberObject);
}
// Done with the file object
Q3Object_Dispose(FileObject);
if (Q3Error_Get(NULL) != kQ3ErrorNone)
{
if (ModelObject)
Q3Object_Dispose(ModelObject);
return NULL;
}
// Finally!
return ModelObject;
}