本文整理汇总了C++中GetResource函数的典型用法代码示例。如果您正苦于以下问题:C++ GetResource函数的具体用法?C++ GetResource怎么用?C++ GetResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetResource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........
示例2: MediaFormatReader
MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
{
MediaDecoderReader* reader = new MediaFormatReader(this, new MP4Demuxer(GetResource()));
return new MediaDecoderStateMachine(this, reader);
}
示例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);
}
示例4: GetResource
const CResource* CResourceHandler::GetResourceByName(const std::string& resourceName) const
{
return GetResource(GetResourceId(resourceName));
}
示例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);
}
示例6: GetResource
CRenderableObjectsManager* CLayerManager::GetLayer(CXMLTreeNode &Node)
{
return GetResource(Node.GetPszProperty("layer",""));
}
示例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();
}
示例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)
//.........这里部分代码省略.........
示例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;
}
示例10: GetResource
CEmiterInstance* CEmiterManager::GetEmiter(const string &_szName) const
{
return GetResource(_szName);
}
示例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:
//.........这里部分代码省略.........
示例12: GetResource
CTrigger* CTriggerManager::GetTrigger(std::string name)
{
return GetResource(name);
}
示例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
}
}
示例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();
//.........这里部分代码省略.........
示例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");
//.........这里部分代码省略.........