本文整理汇总了C++中FileSpecifier::SetNameWithPath方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSpecifier::SetNameWithPath方法的具体用法?C++ FileSpecifier::SetNameWithPath怎么用?C++ FileSpecifier::SetNameWithPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSpecifier
的用法示例。
在下文中一共展示了FileSpecifier::SetNameWithPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindMovieInScript
// Search for level script and then run it
void FindMovieInScript(int LevelIndex)
{
// Find the pointer to the current script
CurrScriptPtr = NULL;
for (vector<LevelScriptHeader>::iterator ScriptIter = LevelScripts.begin();
ScriptIter < LevelScripts.end(); ScriptIter++)
{
if (ScriptIter->Level == LevelIndex) {
CurrScriptPtr = &(*ScriptIter); // Iterator to pointer
break;
}
}
if (!CurrScriptPtr) {
return;
}
for (unsigned k=0; k<CurrScriptPtr->Commands.size(); k++)
{
LevelScriptCommand& Cmd = CurrScriptPtr->Commands[k];
switch(Cmd.Type)
{
case LevelScriptCommand::Movie:
{
MovieFileExists = MovieFile.SetNameWithPath(&Cmd.FileSpec[0]);
// Set the size only if there was a movie file here
if (MovieFileExists) {
MovieSize = Cmd.Size;
}
}
break;
}
}
}
示例2: HandleAttribute
bool XML_ShaderParser::HandleAttribute(const char *Tag, const char *Value) {
if(StringsEqual(Tag,"name")) {
_name = Value;
return true;
}
else if(StringsEqual(Tag,"vert")) {
_vert.SetNameWithPath(Value);
return true;
}
else if(StringsEqual(Tag,"frag")) {
_frag.SetNameWithPath(Value);
return true;
}
else if(StringsEqual(Tag,"passes")) {
return ReadInt16Value(Value,_passes);
}
UnrecognizedTag();
return true;
};
示例3: Start
bool OGL_LoadScreen::Start()
{
// load the image
FileSpecifier File;
if (path.size() == 0) return use = false;
if (!File.SetNameWithPath(path.c_str())) return use = false;
if (!image.LoadFromFile(File, ImageLoader_Colors, 0)) return use = false;
if (!blitter.Load(image)) return use = false;
int screenWidth, screenHeight;
MainScreenSize(screenWidth, screenHeight);
bound_screen();
// the true width/height
int imageWidth = static_cast<int>(image.GetWidth() * image.GetVScale());
int imageHeight = static_cast<int>(image.GetHeight() * image.GetUScale());
if (scale)
{
if (stretch)
{
m_dst.w = screenWidth;
m_dst.h = screenHeight;
}
else if (imageWidth / imageHeight > screenWidth / screenHeight)
{
m_dst.w = screenWidth;
m_dst.h = imageHeight * screenWidth / imageWidth;
}
else
{
m_dst.w = imageWidth * screenHeight / imageHeight;
m_dst.h = screenHeight;
}
}
else
{
m_dst.w = imageWidth;
m_dst.h = imageHeight;
}
m_dst.x = (screenWidth - m_dst.w) / 2;
m_dst.y = (screenHeight - m_dst.h) / 2;
x_offset = m_dst.x;
y_offset = m_dst.y;
x_scale = m_dst.w / (double) imageWidth;
y_scale = m_dst.h / (double) imageHeight;
OGL_ClearScreen();
Progress(0);
return use = true;
}
示例4: load_mmls
static void load_mmls(const Plugin& plugin, XML_Loader_SDL& loader)
{
ScopedSearchPath ssp(plugin.directory);
for (std::vector<std::string>::const_iterator it = plugin.mmls.begin();
it != plugin.mmls.end(); ++it)
{
FileSpecifier file;
file.SetNameWithPath(it->c_str());
loader.ParseFile(file);
}
}
示例5:
static const char *locate_font(const std::string& path)
{
builtin_fonts_t::iterator j = builtin_fonts.find(path);
if (j != builtin_fonts.end() || path == "")
{
return path.c_str();
}
else
{
static FileSpecifier file;
if (file.SetNameWithPath(path.c_str()))
return file.GetPath();
else
return "";
}
}
示例6: LoadSound
bool SoundManager::LoadSound(short sound_index)
{
if (active)
{
SoundDefinition *definition = GetSoundDefinition(sound_index);
if (!definition) return false;
// Load all the external-file sounds for each index; fill the slots appropriately.
int NumSlots= (parameters.flags & _more_sounds_flag) ? definition->permutations : 1;
for (int k = 0; k < NumSlots; k++)
{
SoundOptions *SndOpts = SoundReplacements::instance()->GetSoundOptions(sound_index, k);
if (!SndOpts) continue;
FileSpecifier File;
if (!File.SetNameWithPath(SndOpts->File.c_str())) continue;
if (!SndOpts->Sound.LoadExternal(File)) continue;
}
if (definition->sound_code != NONE &&
(parameters.flags & _ambient_sound_flag) || !(definition->flags & _sound_is_ambient))
{
if (!definition->LoadedSize())
{
definition->Load(*(sound_file.opened_sound_file), parameters.flags & _more_sounds_flag);
loaded_sounds_size += definition->LoadedSize();
definition->last_played = machine_tick_count();
while (loaded_sounds_size > total_buffer_size)
ReleaseLeastUsefulSound();
}
if (definition->LoadedSize())
{
definition->permutations_played = 0;
}
}
return definition->LoadedSize() ? true : false;
}
return false;
}
示例7: GeneralRunScript
// Search for level script and then run it
void GeneralRunScript(int LevelIndex)
{
// Find the pointer to the current script
CurrScriptPtr = NULL;
for (vector<LevelScriptHeader>::iterator ScriptIter = LevelScripts.begin();
ScriptIter < LevelScripts.end(); ScriptIter++)
{
if (ScriptIter->Level == LevelIndex) {
CurrScriptPtr = &(*ScriptIter); // Iterator to pointer
break;
}
}
if (!CurrScriptPtr) {
return;
}
// Insures that this order is the last order set
Music::instance()->LevelMusicRandom(CurrScriptPtr->RandomOrder);
// OpenedResourceFile OFile;
// FileSpecifier& MapFile = get_map_file();
// if (!MapFile.Open(OFile)) return;
for (unsigned k=0; k<CurrScriptPtr->Commands.size(); k++)
{
LevelScriptCommand& Cmd = CurrScriptPtr->Commands[k];
// Data to parse
char *Data = NULL;
size_t DataLen = 0;
// First, try to load a resource (only for scripts)
LoadedResource ScriptRsrc;
switch(Cmd.Type)
{
case LevelScriptCommand::MML:
#ifdef HAVE_LUA
case LevelScriptCommand::Lua:
#endif /* HAVE_LUA */
// if (Cmd.RsrcPresent() && OFile.Get('T','E','X','T',Cmd.RsrcID,ScriptRsrc))
if (Cmd.RsrcPresent() &&
get_text_resource_from_scenario(Cmd.RsrcID,ScriptRsrc)) {
Data = (char *)ScriptRsrc.GetPointer();
DataLen = ScriptRsrc.GetLength();
}
}
switch(Cmd.Type)
{
case LevelScriptCommand::MML:
{
// Skip if not loaded
if (Data == NULL || DataLen <= 0) {
break;
}
// Set to the MML root parser
char ObjName[256];
sprintf(ObjName,"[Map Rsrc %hd for Level %d]",Cmd.RsrcID,LevelIndex);
LSXML_Loader.SourceName = ObjName;
LSXML_Loader.CurrentElement = &RootParser;
LSXML_Loader.ParseData(Data,DataLen);
}
break;
#ifdef HAVE_LUA
case LevelScriptCommand::Lua:
{
// Skip if not loaded
if (Data == NULL || DataLen <= 0) {
break;
}
// Load and indicate whether loading was successful
if (LoadLuaScript(Data, DataLen, _embedded_lua_script)) {
LuaFound = true;
}
}
break;
#endif /* HAVE_LUA */
case LevelScriptCommand::Music:
{
FileSpecifier MusicFile;
if (MusicFile.SetNameWithPath(&Cmd.FileSpec[0])) {
Music::instance()->PushBackLevelMusic(MusicFile);
}
}
break;
#ifdef HAVE_OPENGL
case LevelScriptCommand::LoadScreen:
{
if (Cmd.FileSpec.size() > 0) {
if (Cmd.L || Cmd.T || Cmd.R || Cmd.B) {
OGL_LoadScreen::instance()->Set(Cmd.FileSpec, Cmd.Stretch, Cmd.Scale,
Cmd.L, Cmd.T, Cmd.R - Cmd.L,
Cmd.B - Cmd.T);
OGL_LoadScreen::instance()->Colors()[0] = Cmd.Colors[0];
//.........这里部分代码省略.........