本文整理汇总了C++中GetResource函数的典型用法代码示例。如果您正苦于以下问题:C++ GetResource函数的具体用法?C++ GetResource怎么用?C++ GetResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetResource函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DoUI
Boolean DoUI (GPtr globals)
{
short item;
Str255 hS = ""; //histstatus
int16 currentResources = 0;
DialogPtr dp;
DialogTHndl dt;
gStuff->theRect.top =
gStuff->theRect.left =
gStuff->theRect.bottom =
gStuff->theRect.right = 0;
dt = (DialogTHndl) GetResource ('DLOG', uiID);
HNoPurge ((Handle) dt);
CenterDialog (dt);
dp = GetNewDialog (uiID, nil, (WindowPtr) -1);
(void) SetDialogDefaultItem (dp, ok);
(void) SetDialogCancelItem (dp, cancel);
PIGetString(kHistStatus, hS); // get status string
do
{
currentResources = CountPIResources(histResource);
if (gCurrentHistory < 1)
gCurrentHistory = 1;
if (gCurrentHistory > currentResources)
gCurrentHistory = currentResources;
if (currentResources <= kDHistTotal ||
gCurrentHistory+kDHistTotal > currentResources)
PIDisableControl (dp, kDDownButton); // nothing extra to show
else
PIEnableControl (dp, kDDownButton);
if (gCurrentHistory < 2)
PIDisableControl (dp, kDUpButton);
else
PIEnableControl (dp, kDUpButton);
if (currentResources >= gCurrentHistory && currentResources > 0)
{
PIEnableControl (dp, kDTrimFirst);
PIEnableControl (dp, kDTrimLast);
}
else
{
PIDisableControl (dp, kDTrimFirst);
PIDisableControl (dp, kDTrimLast);
}
UpdateHistories(globals, dp, currentResources, hS);
MoveableModalDialog (dp, gStuff->processEvent, nil, &item);
switch (item)
{
case cancel:
gResult = userCanceledErr;
// have to set this so we don't get recorded
break;
case kDTrimFirst:
if (currentResources >= gCurrentHistory)
{
DeletePIResource (histResource, gCurrentHistory);
gStuff->dirty = TRUE;
}
break;
case kDTrimLast:
if (currentResources >= gCurrentHistory + kDHistTotal-1)
{
DeletePIResource (histResource, gCurrentHistory+ kDHistTotal-1);
gStuff->dirty = TRUE;
}
else if (currentResources > 0)
{
DeletePIResource (histResource, currentResources);
gStuff->dirty = TRUE;
}
break;
case kDUpButton:
gCurrentHistory--;
break;
case kDDownButton:
gCurrentHistory++;
break;
} // end switch (item)
} while (item != ok && item != cancel);
DisposeDialog (dp);
HPurge ((Handle) dt);
return (item == ok);
//.........这里部分代码省略.........
开发者ID:jxfengzi,项目名称:AirPhoto,代码行数:101,代码来源:HistoryUIMac.cpp
示例2: MediaFormatReader
MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
{
MediaDecoderReader* reader = new MediaFormatReader(this, new MP4Demuxer(GetResource()));
return new MediaDecoderStateMachine(this, reader);
}
开发者ID:qiubit,项目名称:gecko-dev,代码行数:6,代码来源:MP4Decoder.cpp
示例3: GetResource
void CMainDialog::StartQuestion(ResTextType text, bool warningYes, bool warningNo, bool fireParticles, DialogCallback yes, DialogCallback no)
{
std::string name;
GetResource(RES_TEXT, text, name);
StartQuestion(name, warningYes, warningNo, fireParticles, yes, no);
}
开发者ID:colobot,项目名称:colobot,代码行数:6,代码来源:maindialog.cpp
示例4: GetResource
const CResource* CResourceHandler::GetResourceByName(const std::string& resourceName) const
{
return GetResource(GetResourceId(resourceName));
}
开发者ID:304471720,项目名称:spring,代码行数:4,代码来源:ResourceHandler.cpp
示例5: GetResourceCount
/**
* Checks whether the names of resources, targets and programs are unique
*
* @param
* @return
* @exception -
* @see
*/
bool CProjectWizardData::CheckUniqueNames ()
{
int iResource1;
int iResource2;
int iTask1;
int iTask2;
CProjectWizardResource *pResource1;
CProjectWizardResource *pResource2;
CProjectWizardTask *pTask1;
CProjectWizardTask *pTask2;
int iNumResources = GetResourceCount();
for (iResource1 = 0; iResource1 < iNumResources; ++iResource1)
{
pResource1 = GetResource(iResource1);
for (iResource2 = iResource1 + 1; iResource2 < GetResourceCount (); ++iResource2)
{
pResource2 = GetResource (iResource2);
if (!CompareNames (IDS_ERR_NON_UNIQUE_RESOURCE, pResource1->GetResource (), pResource2->GetResource (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_NON_UNIQUE_TARGET, pResource1->GetTarget (), pResource2->GetTarget (), FALSE))
return (false);
};
for (iTask1 = 0; iTask1 < pResource1->GetTaskCount (); ++iTask1)
{
pTask1 = pResource1->GetTask (iTask1);
if (!CompareNames (IDS_ERR_EQUAL_TASK_AND_PROGRAM_NAME, pTask1->GetName (), pTask1->GetProgram (), TRUE))
return (false);
for (iTask2 = iTask1 + 1; iTask2 < pResource1->GetTaskCount (); ++iTask2)
{
pTask2 = pResource1->GetTask (iTask2);
if (!CompareNames (IDS_ERR_NON_UNIQUE_TASK, pTask1->GetName (), pTask2->GetName (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_NON_UNIQUE_PROGRAM, pTask1->GetProgram (), pTask2->GetProgram (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_EQUAL_TASK_AND_PROGRAM_NAME, pTask1->GetName (), pTask2->GetProgram (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_EQUAL_TASK_AND_PROGRAM_NAME, pTask1->GetProgram (), pTask2->GetName (), TRUE))
return (false);
};
for (iResource2 = iResource1 + 1; iResource2 < GetResourceCount (); ++iResource2)
{
pResource2 = GetResource (iResource2);
for (iTask2 = 0; iTask2 < pResource2->GetTaskCount (); ++iTask2)
{
pTask2 = pResource2->GetTask (iTask2);
if (!CompareNames (IDS_ERR_NON_UNIQUE_PROGRAM, pTask1->GetProgram (), pTask2->GetProgram (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_EQUAL_TASK_AND_PROGRAM_NAME, pTask1->GetName (), pTask2->GetProgram (), TRUE))
return (false);
if (!CompareNames (IDS_ERR_EQUAL_TASK_AND_PROGRAM_NAME, pTask1->GetProgram (), pTask2->GetName (), TRUE))
return (false);
};
};
};
};
return (true);
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:82,代码来源:ProjectWizardData.cpp
示例6: GetResource
CRenderableObjectsManager* CLayerManager::GetLayer(CXMLTreeNode &Node)
{
return GetResource(Node.GetPszProperty("layer",""));
}
开发者ID:AAnguix,项目名称:TTOD_Engine,代码行数:4,代码来源:LayerManager.cpp
示例7: GetResource
void CScreenPlayerSelect::CreateInterface()
{
CWindow* pw;
CEdit* pe;
CLabel* pl;
CButton* pb;
CList* pli;
CGroup* pg;
Math::Point pos, ddim;
std::string name;
pos.x = 0.10f;
pos.y = 0.10f;
ddim.x = 0.80f;
ddim.y = 0.80f;
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_NAME, name);
pw->SetName(name);
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.40f;
pos.y = 0.10f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
pos.x = 60.0f/640.0f;
pos.y = 313.0f/480.0f;
ddim.x = 120.0f/640.0f;
ddim.y = 32.0f/480.0f;
GetResource(RES_EVENT, EVENT_INTERFACE_NLABEL, name);
pl = pw->CreateLabel(pos, ddim, -1, EVENT_INTERFACE_NLABEL, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
pos.x = 200.0f/640.0f;
pos.y = 320.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 32.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 7, EVENT_LABEL1);
pg->SetState(STATE_SHADOW);
pos.x = 207.0f/640.0f;
pos.y = 328.0f/480.0f;
ddim.x = 144.0f/640.0f;
ddim.y = 18.0f/480.0f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_NEDIT);
pe->SetMaxChar(15);
if(m_main->GetPlayerProfile() != nullptr)
{
name = m_main->GetPlayerProfile()->GetName();
}
else
{
name = CPlayerProfile::GetLastName();
}
pe->SetText(name.c_str());
pe->SetCursor(name.length(), 0);
m_interface->SetFocus(pe);
pos.x = 380.0f/640.0f;
pos.y = 320.0f/480.0f;
ddim.x =100.0f/640.0f;
ddim.y = 32.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOK);
pb->SetState(STATE_SHADOW);
pos.x = 380.0f/640.0f;
pos.y = 250.0f/480.0f;
ddim.x =100.0f/640.0f;
ddim.y = 52.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PERSO);
pb->SetState(STATE_SHADOW);
pos.x = 200.0f/640.0f;
pos.y = 150.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 160.0f/480.0f;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_NLIST);
pli->SetState(STATE_SHADOW);
pos.x = 200.0f/640.0f;
pos.y = 100.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 32.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NDELETE);
pb->SetState(STATE_SHADOW);
SetBackground("textures/interface/interface.png");
CreateVersionDisplay();
ReadNameList();
UpdateNameList();
UpdateNameControl();
}
开发者ID:2asoft,项目名称:colobot,代码行数:98,代码来源:screen_player_select.cpp
示例8: main
int main(int argc, char** argv)
{
argc_main = argc;
argv_main = argv;
SplashColor paperColor;
GooString* filename, *password;
char* spwd;
FILE* f = NULL;
bookinfo* bi;
char buf[1024];
int i;
mkdir(CACHEDIR, 0777);
chmod(CACHEDIR, 0777);
spwd = GetDeviceKey();
if (setgid(102) != 0) fprintf(stderr, "warning: cannot set gid\n");
if (setuid(102) != 0) fprintf(stderr, "warning: cannot set uid\n");
if (spwd)
{
//fprintf(stderr, "password: %s\n", spwd);
password = new GooString(spwd);
}
else
{
fprintf(stderr, "warning: cannot read password\n");
password = NULL;
}
OpenScreen();
signal(SIGFPE, sigfpe_handler);
signal(SIGSEGV, sigsegv_handler);
clock_left = GetThemeInt("panel.clockleft", 0);
bmk_flag = GetResource("bmk_flag", NULL);
if (argc < 2)
{
Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000);
return 0;
}
OriginalName = FileName = argv[1];
bi = GetBookInfo(FileName);
if (bi->title) book_title = strdup(bi->title);
// read config file
globalParams = new GlobalParams();
globalParams->setEnableFreeType("yes");
globalParams->setAntialias((char*)(ivstate.antialiasing ? "yes" : "no"));
globalParams->setVectorAntialias("no");
filename = new GooString(FileName);
doc = new PDFDoc(filename, NULL, NULL);
if (!doc->isOk())
{
int err = doc->getErrorCode();
delete doc;
if (err == 4) // encrypted file
{
filename = new GooString(FileName);
doc = new PDFDoc(filename, NULL, password);
if (!doc->isOk())
{
delete doc;
spwd = query_password();
password = new GooString(spwd);
filename = new GooString(FileName);
doc = new PDFDoc(filename, NULL, password);
if (!doc->isOk())
{
Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000);
return 0;
}
}
}
else
{
Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000);
return 0;
}
}
npages = doc->getNumPages();
paperColor[0] = 255;
paperColor[1] = 255;
paperColor[2] = 255;
splashOut = new MySplashOutputDev(USE4 ? splashModeMono4 : splashModeMono8, 4, gFalse, paperColor);
splashOut->startDoc(doc->getXRef());
Outline* outline = doc->getOutline();
if (outline && outline->getItems())
{
GooList* items = outline->getItems();
if (items->getLength() == 1)
//.........这里部分代码省略.........
开发者ID:pocketbook-free,项目名称:pdfviewer,代码行数:101,代码来源:main.cpp
示例9: GetResourceSize
DWORD GetResourceSize(HMODULE module, char* name, char* type, const char* desc)
{
DWORD len = 0;
return (GetResource(module, name, type, desc, &len, FALSE) == NULL)?0:len;
}
开发者ID:ahe01,项目名称:rufus,代码行数:5,代码来源:stdfn.c
示例10: GetResource
CEmiterInstance* CEmiterManager::GetEmiter(const string &_szName) const
{
return GetResource(_szName);
}
开发者ID:Atridas,项目名称:biogame,代码行数:4,代码来源:EmiterManager.cpp
示例11: CreatePartition
/*
* Create a partition table
* See http://technet.microsoft.com/en-us/library/cc739412.aspx for some background info
* NB: if you modify the MBR outside of using the Windows API, Windows still uses the cached
* copy it got from the last IOCTL, and ignores your changes until you replug the drive
* or issue an IOCTL_DISK_UPDATE_PROPERTIES.
*/
BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL mbr_uefi_marker, uint8_t extra_partitions)
{
const char* PartitionTypeName[2] = { "MBR", "GPT" };
unsigned char* buffer;
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
DRIVE_LAYOUT_INFORMATION_EX4 DriveLayoutEx = {0};
BOOL r;
DWORD i, size, bufsize, pn = 0;
LONGLONG main_part_size_in_sectors, extra_part_size_in_tracks = 0, ms_efi_size;
const LONGLONG bytes_per_track = ((LONGLONG)SelectedDrive.Geometry.SectorsPerTrack) * SelectedDrive.Geometry.BytesPerSector;
PrintInfoDebug(0, MSG_238, PartitionTypeName[partition_style]);
if ((extra_partitions & XP_UEFI_NTFS) && (uefi_ntfs_size == 0)) {
uefi_ntfs_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_NTFS), _RT_RCDATA, "uefi-ntfs.img");
if (uefi_ntfs_size == 0)
return FALSE;
}
// Compute the start offset of our first partition
if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_EXTRA_PARTITION))) {
// Go with the MS 1 MB wastage at the beginning...
DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart = 1024*1024;
} else {
// Align on Cylinder
DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart = bytes_per_track;
}
// If required, set the MSR partition (GPT only - must be created before the data part)
if ((partition_style == PARTITION_STYLE_GPT) && (extra_partitions & XP_MSR)) {
uprintf("Adding MSR partition");
DriveLayoutEx.PartitionEntry[pn].PartitionLength.QuadPart = 128*1024*1024;
DriveLayoutEx.PartitionEntry[pn].Gpt.PartitionType = PARTITION_MSFT_RESERVED_GUID;
IGNORE_RETVAL(CoCreateGuid(&DriveLayoutEx.PartitionEntry[pn].Gpt.PartitionId));
// coverity[strcpy_overrun]
wcscpy(DriveLayoutEx.PartitionEntry[pn].Gpt.Name, L"Microsoft reserved partition");
// We must zero the beginning of this partition, else we get FAT leftovers and stuff
if (SetFilePointerEx(hDrive, DriveLayoutEx.PartitionEntry[pn].StartingOffset, NULL, FILE_BEGIN)) {
bufsize = 65536; // 64K should be enough for everyone
buffer = calloc(bufsize, 1);
if (buffer != NULL) {
if ((!WriteFile(hDrive, buffer, bufsize, &size, NULL)) || (size != bufsize))
uprintf(" Could not zero MSR: %s", WindowsErrorString());
free(buffer);
}
}
pn++;
DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart = DriveLayoutEx.PartitionEntry[pn-1].StartingOffset.QuadPart +
DriveLayoutEx.PartitionEntry[pn-1].PartitionLength.QuadPart;
}
// Set our main data partition
main_part_size_in_sectors = (SelectedDrive.DiskSize - DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart) /
// Need 33 sectors at the end for secondary GPT
SelectedDrive.Geometry.BytesPerSector - ((partition_style == PARTITION_STYLE_GPT)?33:0);
if (main_part_size_in_sectors <= 0)
return FALSE;
// Adjust the size according to extra partitions (which we always align to a track)
if (extra_partitions) {
uprintf("Adding extra partition");
if (extra_partitions & XP_EFI) {
// The size of the EFI partition depends on the minimum size we're able to format in FAT32,
// which in turn depends on the cluster size used, which in turn depends on the disk sector size.
if (SelectedDrive.Geometry.BytesPerSector <= 1024)
ms_efi_size = 100*1024*1024;
else if (SelectedDrive.Geometry.BytesPerSector <= 4096)
ms_efi_size = 300*1024*1024;
else
ms_efi_size = 1200*1024*1024; // That'll teach you to have a nonstandard disk!
extra_part_size_in_tracks = (ms_efi_size + bytes_per_track - 1) / bytes_per_track;
} else if (extra_partitions & XP_UEFI_NTFS)
extra_part_size_in_tracks = (MIN_EXTRA_PART_SIZE + bytes_per_track - 1) / bytes_per_track;
else if (extra_partitions & XP_COMPAT)
extra_part_size_in_tracks = 1; // One track for the extra partition
uprintf("Reserved %" PRIi64" tracks (%s) for extra partition", extra_part_size_in_tracks,
SizeToHumanReadable(extra_part_size_in_tracks * bytes_per_track, TRUE, FALSE));
main_part_size_in_sectors = ((main_part_size_in_sectors / SelectedDrive.Geometry.SectorsPerTrack) -
extra_part_size_in_tracks) * SelectedDrive.Geometry.SectorsPerTrack;
if (main_part_size_in_sectors <= 0)
return FALSE;
}
DriveLayoutEx.PartitionEntry[pn].PartitionLength.QuadPart = main_part_size_in_sectors * SelectedDrive.Geometry.BytesPerSector;
if (partition_style == PARTITION_STYLE_MBR) {
DriveLayoutEx.PartitionEntry[pn].Mbr.BootIndicator = IsChecked(IDC_BOOT);
switch (file_system) {
case FS_FAT16:
DriveLayoutEx.PartitionEntry[pn].Mbr.PartitionType = 0x0e; // FAT16 LBA
break;
case FS_NTFS:
case FS_EXFAT:
//.........这里部分代码省略.........
开发者ID:ntamvl,项目名称:rufus,代码行数:101,代码来源:drive.c
示例12: GetResource
CTrigger* CTriggerManager::GetTrigger(std::string name)
{
return GetResource(name);
}
开发者ID:BGCX261,项目名称:zombigame-svn-to-git,代码行数:4,代码来源:TriggerManager.cpp
示例13: state
/**
In GO SLEEP state (in state ECUM_STATE_GO_SLEEP)
*/
static void in_state_goSleep( void ) {
/* !req EcuMf0026:
* The ECU State Manager Fixed module shall put all communication interfaces to standby state and shall arm the
* wake up source before the ECU State Manager Fixed module may put the ECU into SLEEP state.
*/
/* We only wait for NvM_WriteAll() for so long */
if (EcuM_World_go_sleep_state_timeout) {
EcuM_World_go_sleep_state_timeout--;
#if defined(USE_NVM)
{
NvM_RequestResultType nvmResult;
if((NvM_GetErrorStatus(0, &nvmResult) != E_OK) || (nvmResult != NVM_REQ_PENDING)) {
/* Done or something is wrong...continue */
EcuM_World_go_sleep_state_timeout = 0;
}
}
#endif
}
if( (EcuM_World_go_sleep_state_timeout == 0) ) {
/*
* We should go to sleep , enable source that should wake us
*/
uint32 cMask;
uint8 source;
const EcuM_SleepModeType *sleepModePtr;
/* Get the current sleep mode */
/* @req EcuM2185 */ /* @req EcuMf2185 */
sleepModePtr = &EcuM_World.config->EcuMSleepModeConfig[EcuM_World.sleep_mode];
cMask = sleepModePtr->EcuMWakeupSourceMask;
/* Loop over the WKSOURCE for this sleep mode */
/* @req EcuM2389 */
/* @req EcuM2546 */
for (; cMask; cMask &= ~(1ul << source)) {
source = ilog2(cMask);
/* @req 3.1.5/ECUM2389 */
// DEBUG_ECUM_CALLOUT_W_ARG("EcuM_EnableWakeupSources","0x%lx",(1ul<< source));
EcuM_EnableWakeupSources( 1<< source );
}
/* Let no one else run */
(void)GetResource(RES_SCHEDULER);
SetCurrentState(ECUM_STATE_SLEEP);
} else if( EcuM_GetPendingWakeupEvents() != 0 ) {
/* @req EcuM2188 */ /* @req EcuMf2188 */
/* We have pending wakeup events, need to startup again */
#if defined(USE_NVM)
NvM_CancelWriteAll();
SetCurrentState(ECUM_STATE_SLEEP);
#endif
}
}
开发者ID:miaozhendaoren,项目名称:PWC-Demonstrator,代码行数:65,代码来源:EcuM_Main.c
示例14: AddResource
MOboolean
moResourceManager::Init(
const moText& p_apppath,
const moText& p_datapath,
moConfig& p_consoleconfig,
MOint p_render_to_texture_mode,
MOint p_screen_width,
MOint p_screen_height,
MOint p_render_width,
MOint p_render_height,
MO_HANDLE p_OpWindowHandle,
MO_DISPLAY p_Display) {
if ( GetResourceByType( MO_RESOURCETYPE_DEBUG ) == NULL )
AddResource( new moDebugManager() );
if ( GetResourceByType( MO_RESOURCETYPE_NET ) == NULL )
AddResource( new moNetManager() );
if ( GetResourceByType( MO_RESOURCETYPE_FILE ) == NULL )
AddResource( new moFileManager() );
if ( GetResourceByType( MO_RESOURCETYPE_FILTER ) == NULL )
AddResource( new moFilterManager() );
if ( GetResourceByType( MO_RESOURCETYPE_TIME ) == NULL )
AddResource( new moTimeManager() );
if ( GetResourceByType( MO_RESOURCETYPE_DATA ) == NULL )
AddResource( new moDataManager() );
if ( GetResourceByType( MO_RESOURCETYPE_MATH ) == NULL )
AddResource( new moMathManager() );
if ( GetResourceByType( MO_RESOURCETYPE_SHADER ) == NULL )
AddResource( new moShaderManager() );
if ( GetResourceByType( MO_RESOURCETYPE_FB )==NULL )
AddResource( new moFBManager() );
if ( GetResourceByType( MO_RESOURCETYPE_GL )==NULL )
AddResource( new moGLManager() );
if ( GetResourceByType( MO_RESOURCETYPE_DECODER )==NULL )
AddResource( new moDecoderManager() );
if ( GetResourceByType( MO_RESOURCETYPE_RENDER )==NULL )
AddResource( new moRenderManager() );
if ( GetResourceByType( MO_RESOURCETYPE_TEXTURE )==NULL )
AddResource( new moTextureManager() );
if ( GetResourceByType( MO_RESOURCETYPE_SOUND )==NULL )
AddResource( new moSoundManager() );
if ( GetResourceByType( MO_RESOURCETYPE_VIDEO )==NULL )
AddResource( new moVideoManager() );
if ( GetResourceByType( MO_RESOURCETYPE_MODEL )==NULL )
AddResource( new mo3dModelManager() );
if ( GetResourceByType( MO_RESOURCETYPE_FONT )==NULL )
AddResource( new moFontManager() );
if ( GetResourceByType( MO_RESOURCETYPE_GUI )==NULL )
AddResource( new moGUIManager() );
if ( GetResourceByType( MO_RESOURCETYPE_SCRIPT )==NULL )
AddResource( new moScriptManager() );
///Asigna configname, y labelname a los recursos PREDETERMINADOS en caso de encontrarse en el config
moText resname;
moText cfname;
moText lblname;
///TODO: chequear errores...
moParam& presources(p_consoleconfig.GetParam(moText("resources")));
presources.FirstValue();
for(MOuint r=0; r<presources.GetValuesCount(); r++) {
moResource* pResource = NULL;
resname = presources[MO_SELECTED][MO_CFG_RESOURCE].Text();
cfname = presources[MO_SELECTED][MO_CFG_RESOURCE_CONFIG].Text();
lblname = presources[MO_SELECTED][MO_CFG_RESOURCE_LABEL].Text();
MOint rid = GetResourceIndex( lblname );
if(rid>-1) pResource = GetResource(rid);
if (pResource) {
pResource->SetConfigName(cfname);
pResource->SetLabelName(lblname);
pResource->SetConsoleParamIndex( presources.GetParamDefinition().GetIndex() );
pResource->SetConsoleValueIndex( r );
}
presources.NextValue();
//.........这里部分代码省略.........
开发者ID:inaes-tic,项目名称:tv-libmoldeo,代码行数:101,代码来源:moResourceManager.cpp
示例15: GetResource
void CScreenSetupGame::CreateInterface()
{
CWindow* pw;
CLabel* pl;
CCheck* pc;
CSlider* psl;
CList* pli;
Math::Point pos, ddim;
std::string name;
CScreenSetup::CreateInterface();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
ddim.x = dim.x*6;
ddim.y = dim.y*0.5f;
pos.x = ox+sx*3;
pos.y = 0.65f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SCROLL);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTX);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTY);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_ENABLE);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pos.y -= ddim.y;
ddim.x = dim.x*2.5f;
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_INTERVAL);
psl->SetState(STATE_SHADOW);
psl->SetLimit(1.0f, 30.0f);
psl->SetArrowStep(1.0f);
pos.y += ddim.y/2;
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_INTERVAL, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y -= ddim.y/2;
pos.x = ox+sx*3+dim.x*4.0f;
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_SLOTS);
psl->SetState(STATE_SHADOW);
psl->SetLimit(1.0f, 10.0f);
psl->SetArrowStep(1.0f);
pos.y += ddim.y/2;
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_SLOTS, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y -= ddim.y/2;
ddim.x = dim.x*6;
ddim.y = dim.y*0.5f;
pos.x = ox+sx*10;
pos.y = 0.65f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOOLTIP);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_GLINT);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_RAIN);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BGPAUSE);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITMODE);
pc->SetState(STATE_SHADOW);
if ( m_simulationSetup )
{
pc->SetState(STATE_DEAD);
}
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITVALUE);
pc->SetState(STATE_SHADOW);
ddim.y = dim.y*3.0f;
pos.y -= ddim.y;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LANGUAGE);
pli->SetState(STATE_SHADOW);
// TODO: Add something like GetSupportedLanguages() and GetLanguageFriendlyName() for this
pli->SetItemName(1+LANGUAGE_ENV, "[System default]");
pli->SetItemName(1+LANGUAGE_ENGLISH, "English");
pli->SetItemName(1+LANGUAGE_FRENCH, "French");
pli->SetItemName(1+LANGUAGE_GERMAN, "German");
pli->SetItemName(1+LANGUAGE_POLISH, "Polish");
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:colobot,代码行数:101,代码来源:screen_setup_game.cpp
示例16: GetYearData
// will need to read from text file instead
YEARDATAHDL GetYearData(short year)
{
// IMPORTANT: The calling function should NOT dispose the handle it gets
YEARDATAHDL yrHdl=nil;
short yearMinus1990 = year-1990;
long i,n,resSize=0;
if(0<= yearMinus1990 && yearMinus1990 <kMAXNUMSAVEDYEARS)
{
if(gYearDataHdl1990Plus[yearMinus1990]) return gYearDataHdl1990Plus[yearMinus1990];
}
#ifdef MAC
Handle r = nil;
r=GetResource('YEAR',(long)year);
#ifdef SWAP_BINARY
resSize = GetMaxResourceSize(r);
if(resSize > 0 && r)
{
yrHdl = (YEARDATAHDL)_NewHandle(resSize);
if(yrHdl)
{
_HLock(r); // so it can't be purged !!!
YEARDATAHDL rHdl = (YEARDATAHDL)_NewHandle(resSize);
DetachResource(r);
rHdl = (YEARDATAHDL) r;
// copy and swap the bytes
n = resSize/sizeof(YEARDATA);
for(i = 0; i< n; i++)
{
YEARDATA yrd = (YEARDATA)INDEXH(rHdl,i);
SwapFloat(&yrd.XODE);
SwapFloat(&yrd.VPU);
INDEXH(yrHdl,i) = yrd;
}
// I don't think we free something gotten from a resource
}
ReleaseResource(r);// don't dispose of a resource handle !!!
r = 0;
}
#else
if(r)
{
DetachResource(r);
yrHdl = (YEARDATAHDL) r;
}
#endif
#else
char numStr[32];
HRSRC hResInfo =0;
HGLOBAL r = 0;
sprintf(numStr,"#%ld",year);
hResInfo = FindResource(hInst,numStr,"YEAR");
if(hResInfo)
{
// copy the handle so we can be
// just like the mac
//
//also we need to swap the bytes
//
// be careful r is a HGLOBAL, not one of our special fake handles
resSize = SizeofResource(hInst,hResInfo);
if(resSize > 0) r = LoadResource(hInst,hResInfo);
if(resSize > 0 && r)
{
yrHdl = (YEARDATAHDL)_NewHandle(resSize);
if(yrHdl)
{
YEARDATAPTR rPtr = (YEARDATAPTR) LockResource(r);
// copy and swap the bytes
n = resSize/sizeof(YEARDATA);
for(i = 0; i< n; i++)
{
YEARDATA yrd = rPtr[i];
SwapFloat(&yrd.XODE);
SwapFloat(&yrd.VPU);
INDEXH(yrHdl,i) = yrd;
}
// WIN32 applications do not have to unlock resources locked by LockResource
// I don't think we free something gotten from a resource
}
}
}
#endif
if(yrHdl && 0<= yearMinus1990 && yearMinus1990 <kMAXNUMSAVEDYEARS)
{
gYearDataHdl1990Plus[yearMinus1990] = yrHdl;
}
return(yrHdl);
}
开发者ID:rsignell-usgs,项目名称:PyGnome,代码行数:93,代码来源:TShioTimeValue.cpp
示例17: FT_New_Face_From_SFNT
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
static FT_Error
FT_New_Face_From_SFNT( FT_Library library,
ResID sfnt_id,
FT_Long face_index,
FT_Face* aface )
{
Handle sfnt = NULL;
FT_Byte* sfnt_data;
size_t sfnt_size;
FT_Error error = FT_Err_Ok;
FT_Memory memory = library->memory;
int is_cff, is_sfnt_ps;
sfnt = GetResource( TTAG_sfnt, sfnt_id );
if ( sfnt == NULL )
return FT_THROW( Invalid_Handle );
sfnt_size = (FT_ULong)GetHandleSize( sfnt );
if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
{
ReleaseResource( sfnt );
return error;
}
HLock( sfnt );
ft_memcpy( sfnt_data, *sfnt, sfnt_size );
HUnlock( sfnt );
ReleaseResource( sfnt );
is_cff = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, "typ1", 4 );
if ( is_sfnt_ps )
{
FT_Stream stream;
if ( FT_NEW( stream ) )
goto Try_OpenType;
FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );
if ( !open_face_PS_from_sfnt_stream( library,
stream,
face_index,
0, NULL,
aface ) )
{
FT_Stream_Close( stream );
FT_FREE( stream );
FT_FREE( sfnt_data );
goto Exit;
}
FT_FREE( stream );
}
Try_OpenType:
error = open_face_from_buffer( library,
sfnt_data,
sfnt_size,
face_index,
is_cff ? "cff" : "truetype",
aface );
Exit:
return error;
}
开发者ID:coapp-packages,项目名称:freetype,代码行数:67,代码来源:ftmac.c
示例18: MediaFormatReader
MediaDecoderStateMachine*
MP3Decoder::CreateStateMachine() {
nsRefPtr<MediaDecoderReader> reader =
new MediaFormatReader(this, new mp3::MP3Demuxer(GetResource()));
return new MediaDecoderStateMachine(this, reader);
}
开发者ID:h4writer,项目名称:oomrepo,代码行数:6,代码来源:MP3Decoder.cpp
示例19: cairo_set_fill_rule
void CairoRenderer::RenderOperator(const Operator *pOp, const Object **pParams, int nParams)
{
const char *cstr;
double x, y;
double v[6];
int i, n;
const Object *pObj;
const Stream *pStream;
const Dictionary *pDict;
cairo_matrix_t matrix;
int nWidth, nHeight;
cairo_surface_t *pSurface;
cstr = pOp->GetValue();
if (strchr("fFbBW", *cstr) != NULL)
if (cstr[1] == '\0')
cairo_set_fill_rule(m_pCairo, CAIRO_FILL_RULE_WINDING);
else if (cstr[1] == '*')
cairo_set_fill_rule(m_pCairo, CAIRO_FILL_RULE_EVEN_ODD);
if (*cstr == 'b') //close, fill, and stroke
{
cairo_close_path(m_pCairo);
cairo_fill(m_pCairo);
Stroke();
}
else if (strcmp(cstr, "B") == 0 || strcmp(cstr, "B*") == 0) //fill and stroke
{
cairo_fill(m_pCairo);
Stroke();
}
else if (strcmp(cstr, "BDC") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "BI") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "BMC") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "BT") == 0)
{
cairo_save(m_pCairo);
cairo_move_to(m_pCairo, 0.0, 0.0);
m_cairo_face = NULL;
}
else if (strcmp(cstr, "BX") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "c") == 0) //curve to
{
ConvertNumeric(pParams, nParams, v);
cairo_curve_to(m_pCairo, v[0], v[1], v[2], v[3], v[4], v[5]);
}
else if (strcmp(cstr, "cm") == 0) //concat
{
ConvertNumeric(pParams, nParams, v);
cairo_matrix_init(&matrix, v[0], v[1], v[2], v[3], v[4], v[5]);
cairo_transform(m_pCairo, &matrix);
}
else if (strcmp(cstr, "CS") == 0) //color space
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "cs") == 0) //color space
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "d") == 0) //line dash
SetDash(pParams[0], pParams[1]);
else if (strcmp(cstr, "d0") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "d1") == 0)
{
NOT_IMPLEMENTED;
}
else if (strcmp(cstr, "Do") == 0)
{
pStream = (const Stream *)GetResource(XOBJECT, ((Name *)pParams[0])->GetValue());
pDict = pStream->GetDictionary();
pObj = pDict->GetValue("Subtype");
if (strcmp(((const Name *)pObj)->GetValue(), "Image") == 0)
{
nWidth = ((const Numeric *)pDict->GetValue("Width"))->GetValue();
nHeight = ((const Numeric *)pDict->GetValue("Height"))->GetValue();
cairo_matrix_init(&matrix, 1.0 / nWidth, 0.0, 0.0, -1.0 / nHeight, 0.0, 1.0);
cairo_save(m_pCairo);
cairo_transform(m_pCairo, &matrix);
cairo_rectangle(m_pCairo, 0.0, 0.0, nWidth, nHeight);
cairo_clip(m_pCairo);
pSurface = CreateImageSurface(pStream, nWidth, nHeight);
cairo_set_source_surface(m_pCairo, pSurface, 0.0, 0.0);
cairo_paint(m_pCairo);
//.........这里部分代码省略.........
开发者ID:vincent0629,项目名称:PDFParser,代码行数:101,代码来源:CairoRenderer.cpp
示例20: test_t1_instance
/*test case:test the reaction of the system called with
an activation of a task*/
static void test_t1_instance(void)
{
StatusType result_inst_1, result_inst_1_5, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9, result_inst_10, result_inst_11, result_inst_12, result_inst_13, result_inst_14, result_inst_15, result_inst_16, result_inst_17, result_inst_18, result_inst_19, result_inst_20;
SCHEDULING_CHECK_INIT(1);
result_inst_1 = GetResource(ResourceA);
SCHEDULING_CHECK_AND_EQUAL_INT(1 , E_OK, result_inst_1);
SCHEDULING_CHECK_INIT(2);
result_inst_1_5 = ReleaseResource(ResourceA);
SCHEDULING_CHECK_AND_EQUAL_INT(2 , E_OK, result_inst_1_5);
SCHEDULING_CHECK_INIT(3);
result_inst_2 = GetResource(INVALID_RESOURCE);
SCHEDULING_CHECK_AND_EQUAL_INT(3 , E_OS_ID, result_inst_2);
SCHEDULING_CHECK_INIT(4);
result_inst_3 = GetResource(source1);
SCHEDULING_CHECK_AND_EQUAL_INT(4 , E_OK, result_inst_3);
SCHEDULING_CHECK_INIT(5);
result_inst_4 = GetResource(Resource2);
SCHEDULING_CHECK_AND_EQUAL_INT(5 , E_OK, result_inst_4);
SCHEDULING_CHECK_INIT(6);
result_inst_5 = GetResource(Resource3);
SCHEDULING_CHECK_AND_EQUAL_INT(6 , E_OK, result_inst_5);
SCHEDULING_CHECK_INIT(7);
result_inst_6 = GetResource(Resource4);
SCHEDULING_CHECK_AND_EQUAL_INT(7 , E_OK, result_inst_6);
SCHEDULING_CHECK_INIT(8);
result_inst_7 = GetResource(Resource5);
SCHEDULING_CHECK_AND_EQUAL_INT(8 , E_OK, result_inst_7);
SCHEDULING_CHECK_INIT(9);
result_inst_8 = GetResource(Resource6);
SCHEDULING_CHECK_AND_EQUAL_INT(9 , E_OK, result_inst_8);
SCHEDULING_CHECK_INIT(10);
result_inst_9 = ReleaseResource(Resource6);
SCHEDULING_CHECK_AND_EQUAL_INT(10 , E_OK, result_inst_9);
SCHEDULING_CHECK_INIT(11);
result_inst_10 = ReleaseResource(Resource5);
SCHEDULING_CHECK_AND_EQUAL_INT(11 , E_OK, result_inst_10);
SCHEDULING_CHECK_INIT(12);
result_inst_11 = ReleaseResource(Resource4);
SCHEDULING_CHECK_AND_EQUAL_INT(12 , E_OK, result_inst_11);
SCHEDULING_CHECK_INIT(13);
result_inst_12 = ReleaseResource(Resource3);
SCHEDULING_CHECK_AND_EQUAL_INT(13 , E_OK, result_inst_12);
SCHEDULING_CHECK_INIT(14);
result_inst_13 = ReleaseResource(source1);
SCHEDULING_CHECK_AND_EQUAL_INT(14 , E_OS_NOFUNC, result_inst_13);
SCHEDULING_CHECK_INIT(15);
result_inst_14 = ReleaseResource(Resource2);
SCHEDULING_CHECK_AND_EQUAL_INT(15 , E_OK, result_inst_14);
SCHEDULING_CHECK_INIT(16);
result_inst_15 = GetResource(source1);
SCHEDULING_CHECK_AND_EQUAL_INT(16 , E_OS_ACCESS, result_inst_15);
SCHEDULING_CHECK_INIT(17);
result_inst_17 = ReleaseResource(source1);
SCHEDULING_CHECK_AND_EQUAL_INT(17 , E_OK, result_inst_17);
SCHEDULING_CHECK_INIT(18);
result_inst_16 = ActivateTask(t2);
/*force scheduling*/
SCHEDULING_CHECK_AND_EQUAL_INT(21 , E_OK, result_inst_16);
SCHEDULING_CHECK_INIT(22);
r
|
请发表评论