本文整理汇总了C++中DirPath类的典型用法代码示例。如果您正苦于以下问题:C++ DirPath类的具体用法?C++ DirPath怎么用?C++ DirPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DirPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scan
void FileList::scan( const char * pattern )
{
files.clear();
WIN32_FIND_DATAA FindFileData;
HANDLE hFind;
DirPath loc = folder;
loc << pattern;
std::string base = folder.c_str();
std::string filename;
hFind = FindFirstFileA( loc.c_str(), &FindFileData );
/*int i = 0;*/
while( hFind != INVALID_HANDLE_VALUE )
{
filename = FindFileData.cFileName;
FileListEntry tempfile( base, filename );
files.push_back( tempfile );
if( FindNextFileA( hFind, &FindFileData ) == 0 )
{
break;
}
}
FindClose( hFind );
}
示例2: DirPath
void sConfigData::get_resolution_data(TiXmlElement *el)
{
resolution.configXML = false;
const char *pt;
string testa = "";
if (pt = el->Attribute("Resolution")) get_att(el, "Resolution", testa);
if (testa != "")
{
DirPath location = DirPath() << "Resources" << "Interface" << testa;
XMLFileList test(location, "*.xml");
if (test.size() > 0)
{
resolution.resolution = testa;
l.ss() << "Success: config.xml: Loading Interface: " << location.c_str(); l.ssend();
}
else
{
l.ss() << "\n\nWarning: config.xml:\n'Resolution' attribute points to an invalid interface folder:\ndefaulting to 'J_1024x768'\n\n"; l.ssend();
}
}
else
{
l.ss() << "\n\nWarning: config.xml: No Resolution specified, using defaults.\n\n"; l.ssend();
}
if (pt = el->Attribute("Width")) { get_att(el, "Width", &resolution.width); resolution.configXML = true; }
if (pt = el->Attribute("Height")) { get_att(el, "Height", &resolution.height); resolution.configXML = true; }
if (pt = el->Attribute("ScaleWidth")) { get_att(el, "ScaleWidth", &resolution.scalewidth); }
if (pt = el->Attribute("ScaleHeight")) { get_att(el, "ScaleHeight", &resolution.scaleheight); }
if (pt = el->Attribute("FullScreen")) { get_att(el, "FullScreen", resolution.fullscreen); }
if (pt = el->Attribute("ListScrollAmount")) { get_att(el, "ListScrollAmount", &resolution.list_scroll); }
if (pt = el->Attribute("TextScrollAmount")) { get_att(el, "TextScrollAmount", &resolution.text_scroll); }
}
示例3: ButtonPath
void cInterfaceWindow::AddButtonND(string image_name, int & ID, int x, int y, int width, int height, bool transparency, bool scale, bool cached)
{
DirPath dp = ButtonPath(image_name);
string on = string(dp.c_str()) + "On.png";
string off = string(dp.c_str()) + "Off.png";
string disabled = "";
AddButton(off, disabled, on, ID, x, y, width, height, transparency, scale, cached);
}
示例4: DirPath
cScreenGangs::cScreenGangs()
{
DirPath dp = DirPath()
<< "Resources"
<< "Interface"
<< "gangs_screen.xml"
;
m_filename = dp.c_str();
}
示例5: DirPath
void MasterFile::LoadLegacy( std::string filename )
{
files.clear();
std::ifstream ifs;
char buffer[1024]; // power of 2 makes better use of memory
/*
* format the path for the master file.
*/
std::string mfile = filename + ".mast";
DirPath mastfile = DirPath() << "Saves" << mfile;
filename = mastfile.c_str();
/*
* open the file
*/
ifs.open( mastfile.c_str() );
/*
* problem opening the file?
*/
if( !ifs.good() )
{
ifs.close();
return;
}
/*
* loop through the file, one line at a time
*/
while( ifs.good() )
{
/*
* Using "sizeof()" means that the size is right even if the
* buffer size is later changed.
*/
ifs.getline(buffer, sizeof(buffer)-1, '\n');
if( std::string(buffer).empty() == false )
{
/*
* add the file to the map
*/
files[std::string(buffer)] = 1;
}
}
ifs.close();
}
示例6: DirPath
bool CGraphics::InitGraphics(string caption, int Width, int Height, int BPP)
{
cConfig cfg;
if (Width == 0 || Height == 0)
{
if (cfg.resolution.configXML())
{
m_ScreenWidth = _G.g_ScreenWidth = cfg.resolution.width();
m_ScreenHeight = _G.g_ScreenHeight = cfg.resolution.height();
_G.g_Fullscreen = cfg.resolution.fullscreen();
}
else // `J` merged ScreenMode.txt into config.xml - left this in for legacy
{
char buffer[1000];
ifstream incol;
// WD: Typecast to resolve ambiguous call in VS 2010
DirPath dp = DirPath() << "ScreenMode.txt";
g_LogFile.write("Reading Screen Mode");
incol.open(dp.c_str());
if (incol)
{
incol.ignore(1000, '\n'); // ignore first line
incol >> _G.g_ScreenWidth >> _G.g_ScreenHeight;
incol.ignore(1000, '\n'); // width/height
incol.getline(buffer, 1000, '\n');
if (strcmp(buffer, "true") == 0)
_G.g_Fullscreen = true;
else
_G.g_Fullscreen = false;
}
incol.close();
m_ScreenWidth = _G.g_ScreenWidth;
m_ScreenHeight = _G.g_ScreenHeight;
}
}
else
{
示例7: LoadInterface
void LoadInterface()
{
cTariff tariff;
stringstream ss;
int r = 0, g = 0, b = 0, a = 0, c = 0, d = 0, e = 0, fontsize = 16,
increment = 0, min = 0, max = 0, value = 0;
string image = ""; string text = ""; string file = "";
bool Transparency = false, Scale = true, multi = false, events = false, liveUpdate = false;
ifstream incol;
g_LogFile.write("Begin Loading Interface");
// load interface colors
int loadcolors = 0; // 0=default, 1=xml, 2=txt
DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "InterfaceColors.xml";
TiXmlDocument docInterfaceColors(dp.c_str());
if (docInterfaceColors.LoadFile()) loadcolors = 1;
else // try txt
{
if (cfg.debug.log_debug())
{
g_LogFile.ss() << "Error: line " << docInterfaceColors.ErrorRow() << ", col " << docInterfaceColors.ErrorCol() << ": " << docInterfaceColors.ErrorDesc() << endl;
g_LogFile.ssend();
}
DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "InterfaceColors.txt";
incol.open(dp.c_str());
loadcolors = (incol.good()) ? 2 : 0;
incol.close();
}
if (loadcolors == 1) // load "InterfaceColors.xml"
{
g_LogFile.write("Loading InterfaceColors.xml");
string m_filename = dp.c_str();
TiXmlElement *el, *root_el = docInterfaceColors.RootElement();
for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement())
{
string tag = el->ValueStr();
if (tag == "Color")
{
XmlUtil xu(m_filename); string name; int r, g, b;
xu.get_att(el, "Name", name);
xu.get_att(el, "R", r); xu.get_att(el, "G", g); xu.get_att(el, "B", b);
if (name == "ImageBackground") { g_StaticImageR = r; g_StaticImageG = g; g_StaticImageB = b; }
else if (name == "ChoiceBoxText") { g_ChoiceMessageTextR = r; g_ChoiceMessageTextG = g; g_ChoiceMessageTextB = b; }
else if (name == "ChoiceBoxBorder") { g_ChoiceMessageBorderR = r; g_ChoiceMessageBorderG = g; g_ChoiceMessageBorderB = b; }
else if (name == "ChoiceBoxBackground") { g_ChoiceMessageBackgroundR = r; g_ChoiceMessageBackgroundG = g; g_ChoiceMessageBackgroundB = b; }
else if (name == "ChoiceBoxSelected") { g_ChoiceMessageSelectedR = r; g_ChoiceMessageSelectedG = g; g_ChoiceMessageSelectedB = b; }
else if (name == "EditBoxBorder") { g_EditBoxBorderR = r; g_EditBoxBorderG = g; g_EditBoxBorderB = b; }
else if (name == "EditBoxBackground") { g_EditBoxBackgroundR = r; g_EditBoxBackgroundG = g; g_EditBoxBackgroundB = b; }
else if (name == "EditBoxSelected") { g_EditBoxSelectedR = r; g_EditBoxSelectedG = g; g_EditBoxSelectedB = b; }
else if (name == "EditBoxText") { g_EditBoxTextR = r; g_EditBoxTextG = g; g_EditBoxTextB = b; }
else if (name == "WindowBorder") { g_WindowBorderR = r; g_WindowBorderG = g; g_WindowBorderB = b; }
else if (name == "WindowBackground") { g_WindowBackgroundR = r; g_WindowBackgroundG = g; g_WindowBackgroundB = b; }
else if (name == "ListBoxBorder") { g_ListBoxBorderR = r; g_ListBoxBorderG = g; g_ListBoxBorderB = b; }
else if (name == "ListBoxBackground") { g_ListBoxBackgroundR = r; g_ListBoxBackgroundG = g; g_ListBoxBackgroundB = b; }
else if (name == "ListBoxElementBackground") { g_ListBoxElementBackgroundR = r; g_ListBoxElementBackgroundG = g; g_ListBoxElementBackgroundB = b; }
else if (name == "ListBoxSpecialElement1") { g_ListBoxS1ElementBackgroundR = r; g_ListBoxS1ElementBackgroundG = g; g_ListBoxS1ElementBackgroundB = b; }
else if (name == "ListBoxSpecialElement2") { g_ListBoxS2ElementBackgroundR = r; g_ListBoxS2ElementBackgroundG = g; g_ListBoxS2ElementBackgroundB = b; }
else if (name == "ListBoxSpecialElement3") { g_ListBoxS3ElementBackgroundR = r; g_ListBoxS3ElementBackgroundG = g; g_ListBoxS3ElementBackgroundB = b; }
else if (name == "ListBoxSelectedElement") { g_ListBoxSelectedElementR = r; g_ListBoxSelectedElementG = g; g_ListBoxSelectedElementB = b; }
else if (name == "ListBoxSelectedSpecialElement1") { g_ListBoxSelectedS1ElementR = r; g_ListBoxSelectedS1ElementG = g; g_ListBoxSelectedS1ElementB = b; }
else if (name == "ListBoxSelectedSpecialElement2") { g_ListBoxSelectedS2ElementR = r; g_ListBoxSelectedS2ElementG = g; g_ListBoxSelectedS2ElementB = b; }
else if (name == "ListBoxSelectedSpecialElement3") { g_ListBoxSelectedS3ElementR = r; g_ListBoxSelectedS3ElementG = g; g_ListBoxSelectedS3ElementB = b; }
else if (name == "ListBoxElementBorderTopLeft") { g_ListBoxElementBorderR = r; g_ListBoxElementBorderG = g; g_ListBoxElementBorderB = b; }
else if (name == "ListBoxElementBorderBottomRight") { g_ListBoxElementBorderHR = r; g_ListBoxElementBorderHG = g; g_ListBoxElementBorderHB = b; }
else if (name == "ListBoxFont") { g_ListBoxTextR = r; g_ListBoxTextG = g; g_ListBoxTextB = b; }
else if (name == "ListBoxColumnHeaderBackground") { g_ListBoxHeaderBackgroundR = r; g_ListBoxHeaderBackgroundG = g; g_ListBoxHeaderBackgroundB = b; }
else if (name == "ListBoxColumnHeaderBorderTopLeft") { g_ListBoxHeaderBorderR = r; g_ListBoxHeaderBorderG = g; g_ListBoxHeaderBorderB = b; }
else if (name == "ListBoxColumnHeaderBorderBottomRight"){ g_ListBoxHeaderBorderHR = r; g_ListBoxHeaderBorderHG = g; g_ListBoxHeaderBorderHB = b; }
else if (name == "ListBoxColumnHeaderFont") { g_ListBoxHeaderTextR = r; g_ListBoxHeaderTextG = g; g_ListBoxHeaderTextB = b; }
else if (name == "MessageBoxBorder") { g_MessageBoxBorderR = r; g_MessageBoxBorderG = g; g_MessageBoxBorderB = b; }
else if (name == "MessageBoxBackground0") { g_MessageBoxBackground0R = r; g_MessageBoxBackground0G = g; g_MessageBoxBackground0B = b; }
else if (name == "MessageBoxBackground1") { g_MessageBoxBackground1R = r; g_MessageBoxBackground1G = g; g_MessageBoxBackground1B = b; }
else if (name == "MessageBoxBackground2") { g_MessageBoxBackground2R = r; g_MessageBoxBackground2G = g; g_MessageBoxBackground2B = b; }
else if (name == "MessageBoxBackground3") { g_MessageBoxBackground3R = r; g_MessageBoxBackground3G = g; g_MessageBoxBackground3B = b; }
else if (name == "MessageBoxText") { g_MessageBoxTextR = r; g_MessageBoxTextG = g; g_MessageBoxTextB = b; }
else if (name == "CheckboxBorder") { g_CheckBoxBorderR = r; g_CheckBoxBorderG = g; g_CheckBoxBorderB = b; }
else if (name == "CheckboxBackground") { g_CheckBoxBackgroundR = r; g_CheckBoxBackgroundG = g; g_CheckBoxBackgroundB = b; }
// ItemRarity is loaded in sConfig.cpp
}
}
}
else if (loadcolors==2)
{
g_LogFile.write("Loading InterfaceColors.txt");
incol.open(dp.c_str());
incol.seekg(0);
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_StaticImageR = r; g_StaticImageG = g; g_StaticImageB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageTextR = r; g_ChoiceMessageTextG = g; g_ChoiceMessageTextB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageBorderR = r; g_ChoiceMessageBorderG = g; g_ChoiceMessageBorderB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageBackgroundR = r; g_ChoiceMessageBackgroundG = g; g_ChoiceMessageBackgroundB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageSelectedR = r; g_ChoiceMessageSelectedG = g; g_ChoiceMessageSelectedB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxBorderR = r; g_EditBoxBorderG = g; g_EditBoxBorderB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxBackgroundR = r; g_EditBoxBackgroundG = g; g_EditBoxBackgroundB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxSelectedR = r; g_EditBoxSelectedG = g; g_EditBoxSelectedB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxTextR = r; g_EditBoxTextG = g; g_EditBoxTextB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_WindowBorderR = r; g_WindowBorderG = g; g_WindowBorderB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_WindowBackgroundR = r; g_WindowBackgroundG = g; g_WindowBackgroundB = b;
incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxBorderR = r; g_ListBoxBorderG = g; g_ListBoxBorderB = b;
//.........这里部分代码省略.........
示例8: AG_FreeSurfaces
// `J` Totally new method for image handling for .06.02.00
void cInterfaceWindow::PrepareImage(int id, sGirl* girl, int imagetype, bool rand, int ImageNum, bool gallery, string ImageName)
{
if (!girl) return; // no girl, no images
if (m_Images[id] &&
m_Images[id]->m_AnimatedImage &&
m_Images[id]->m_AnimatedImage->getNumFrames() > 0)
{
AG_FreeSurfaces(m_Images[id]->m_AnimatedImage->getAFrames(), m_Images[id]->m_AnimatedImage->getNumFrames());
m_Images[id]->m_AnimatedImage->m_Gif = false;
m_Images[id]->m_AnimatedImage = 0;
}
string girlName = girl->m_Name;
int dir = 0; DirPath usedir = "";
DirPath imagedirCc = DirPath(cfg.folders.characters().c_str()) << girlName; // usedir = 1
DirPath imagedirCo = DirPath() << "Resources" << "Characters" << girlName; // usedir = 2
DirPath imagedirDc = DirPath(cfg.folders.defaultimageloc().c_str()); // usedir = -1
DirPath imagedirDo = DirPath() << "Resources" << "DefaultImages"; // usedir = -2
FileList tiCc(imagedirCc, "*.*");
FileList tiCo(imagedirCo, "*.*");
FileList tiDc(imagedirDc, "*.*");
FileList tiDo(imagedirDo, "*.*");
int totalimagesCc = tiCc.size();
int totalimagesCo = tiCo.size();
int totalimagesDc = tiDc.size();
int totalimagesDo = tiDo.size();
if (totalimagesCc + totalimagesCo + totalimagesDc + totalimagesDo < 1) // no images at all so return a blank image
{
m_Images[id]->m_Image = new CSurface(ImagePath("blank.png"));
m_Images[id]->m_AnimatedImage = 0;
m_Images[id]->m_Image->m_Message = "No image found.";
return;
}
int tries = 40;
if (gallery) tries = 0;
else // try some corrections
{
if (cfg.folders.preferdefault() || totalimagesCc + totalimagesCo < 1) tries = 10;
if (imagetype < 0 || imagetype > NUM_IMGTYPES) imagetype = IMGTYPE_PROFILE;
if (girl->is_pregnant() && imagetype < IMGTYPE_PREGNANT) imagetype += PREG_OFFSET;
if (!girl->is_pregnant() && imagetype == IMGTYPE_PREGNANT) imagetype = IMGTYPE_PROFILE;
if (!girl->is_pregnant() && imagetype > IMGTYPE_PREGNANT) imagetype -= PREG_OFFSET;
}
string file = "";
string filename = "";
string ext = "";
bool imagechosen = false;
do
{
int tryimagetype = TryImageType(imagetype, tries);
// choose an image folder
dir = 0; usedir = "";
string checkfor = pic_types[tryimagetype] + "*";
if (tryimagetype == IMGTYPE_PREGNANT) checkfor = "pregnant*.*";
if (totalimagesCc > 0)
{
FileList testall(imagedirCc, checkfor.c_str());
if (tryimagetype == IMGTYPE_PREGNANT)
{
for (u_int i = 0; i < numeric.size(); i++)
{
string t = ("preg" + numeric.substr(i, 1) + "*.*");
testall.add(t.c_str());
}
}
if (testall.size() > 0)
{
usedir = imagedirCc;
dir = 1;
}
}
if (dir == 0 && totalimagesCo > 0) // if config is not found, check for images in the original folder
{
FileList testall(imagedirCo, checkfor.c_str());
if (tryimagetype == IMGTYPE_PREGNANT)
{
for (u_int i = 0; i < numeric.size(); i++)
{
string t = ("preg" + numeric.substr(i, 1) + "*.*");
testall.add(t.c_str());
}
}
if (testall.size() > 0)
{
usedir = imagedirCo;
dir = 2;
}
}
if (dir == 0 && gallery) // gallery stops here if there are no images
{
m_Images[id]->m_Image = new CSurface(ImagePath("blank.png"));
m_Images[id]->m_AnimatedImage = 0;
m_Images[id]->m_Image->m_Message = "No images found.";
break;
//.........这里部分代码省略.........
示例9: SetPosition
void cListBox::CreateListbox(int ID, int x, int y, int width, int height, int BorderSize, bool MultiSelect, bool ShowHeaders, bool HeaderDiv, bool HeaderSort)
{
SDL_Rect dest_rect;
m_ShowHeaders = ShowHeaders;
m_HeaderDividers = HeaderDiv;
m_HeaderClicksSort = HeaderSort;
m_ID = ID;
m_BorderSize = BorderSize;
SetPosition(x, y, width, height);
m_Border = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0, 0, 0, 0);
SDL_FillRect(m_Border, 0, SDL_MapRGB(m_Border->format, g_ListBoxBorderR, g_ListBoxBorderG, g_ListBoxBorderB));
m_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, width - (BorderSize * 2) - 16, height - (BorderSize * 2), 32, 0, 0, 0, 0);
SDL_FillRect(m_Background, 0, SDL_MapRGB(m_Background->format, g_ListBoxBackgroundR, g_ListBoxBackgroundG, g_ListBoxBackgroundB));
m_NumDrawnElements = height / LISTBOX_ITEMHEIGHT;
if (m_ShowHeaders) // Account for headers if shown
m_NumDrawnElements--;
m_eWidth = (width - (BorderSize * 2));
m_eHeight = LISTBOX_ITEMHEIGHT;
m_RedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_RedBackground, 0, SDL_MapRGB(m_RedBackground->format, g_ListBoxS1ElementBackgroundR, g_ListBoxS1ElementBackgroundG, g_ListBoxS1ElementBackgroundB));
m_DarkBlueBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_DarkBlueBackground, 0, SDL_MapRGB(m_DarkBlueBackground->format, g_ListBoxS2ElementBackgroundR, g_ListBoxS2ElementBackgroundG, g_ListBoxS2ElementBackgroundB));
m_GreenBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_GreenBackground, 0, SDL_MapRGB(m_GreenBackground->format, g_ListBoxS3ElementBackgroundR, g_ListBoxS3ElementBackgroundG, g_ListBoxS3ElementBackgroundB));
m_YellowBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_YellowBackground, 0, SDL_MapRGB(m_YellowBackground->format, g_ListBoxS4ElementBackgroundR, g_ListBoxS4ElementBackgroundG, g_ListBoxS4ElementBackgroundB));
m_ElementBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_ElementBackground, 0, SDL_MapRGB(m_ElementBackground->format, g_ListBoxElementBackgroundR, g_ListBoxElementBackgroundG, g_ListBoxElementBackgroundB));
m_ElementSelectedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_ElementSelectedBackground, 0, SDL_MapRGB(m_ElementSelectedBackground->format, g_ListBoxSelectedElementR, g_ListBoxSelectedElementG, g_ListBoxSelectedElementB));
m_SelectedRedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_SelectedRedBackground, 0, SDL_MapRGB(m_SelectedRedBackground->format, g_ListBoxSelectedS1ElementR, g_ListBoxSelectedS1ElementG, g_ListBoxSelectedS1ElementB));
m_SelectedDarkBlueBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_SelectedDarkBlueBackground, 0, SDL_MapRGB(m_SelectedDarkBlueBackground->format, g_ListBoxSelectedS2ElementR, g_ListBoxSelectedS2ElementG, g_ListBoxSelectedS2ElementB));
m_SelectedGreenBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_SelectedGreenBackground, 0, SDL_MapRGB(m_SelectedGreenBackground->format, g_ListBoxSelectedS3ElementR, g_ListBoxSelectedS3ElementG, g_ListBoxSelectedS3ElementB));
m_SelectedYellowBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0);
SDL_FillRect(m_SelectedYellowBackground, 0, SDL_MapRGB(m_SelectedYellowBackground->format, g_ListBoxSelectedS3ElementR, g_ListBoxSelectedS3ElementG, g_ListBoxSelectedS3ElementB));
m_ElementBorder = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 16, m_eHeight, 32, 0, 0, 0, 0);
SDL_FillRect(m_ElementBorder, 0, SDL_MapRGB(m_ElementBorder->format, g_ListBoxElementBorderR, g_ListBoxElementBorderG, g_ListBoxElementBorderB));
// "beveled" looking border for bottom & right sides of list element
dest_rect.x = m_BorderSize;
dest_rect.y = m_BorderSize;
dest_rect.h = m_eHeight - m_BorderSize;
dest_rect.w = m_eWidth - m_BorderSize - 16;
SDL_FillRect(m_ElementBorder, &dest_rect, SDL_MapRGB(m_ElementBorder->format, g_ListBoxElementBorderHR, g_ListBoxElementBorderHG, g_ListBoxElementBorderHB));
if (ShowHeaders)
{
// background for optional column header box
int scroll_space = (HeaderSort) ? 0 : 16;
dest_rect.w = m_eWidth - m_BorderSize - scroll_space;
m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - scroll_space, m_eHeight, 32, 0, 0, 0, 0);
SDL_FillRect(m_HeaderBackground, 0, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBorderR, g_ListBoxHeaderBorderG, g_ListBoxHeaderBorderB));
SDL_FillRect(m_HeaderBackground, &dest_rect, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBorderHR, g_ListBoxHeaderBorderHG, g_ListBoxHeaderBorderHB));
dest_rect.h = m_eHeight - (m_BorderSize * 2);
dest_rect.w = m_eWidth - (m_BorderSize * 2) - scroll_space;
SDL_FillRect(m_HeaderBackground, &dest_rect, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBackgroundR, g_ListBoxHeaderBackgroundG, g_ListBoxHeaderBackgroundB));
DirPath dp = ImagePath("ListboxSort");
string Asc = string(dp.c_str()) + "Asc.png";
string Desc = string(dp.c_str()) + "Desc.png";
string None = string(dp.c_str()) + "None.png";
if (m_HeaderSortAsc == 0) m_HeaderSortAsc = IMG_Load(Asc.c_str());
if (m_HeaderSortDesc == 0) m_HeaderSortDesc = IMG_Load(Desc.c_str());
if (m_HeaderUnSort == 0) m_HeaderUnSort = IMG_Load(None.c_str());
// draw the "un-sort" clickable header
if (HeaderSort)
{
m_Divider.x = m_eWidth - 17;
m_Divider.w = 2;
SDL_FillRect(
m_HeaderBackground,
&m_Divider,
SDL_MapRGB(
m_HeaderBackground->format,
g_ListBoxHeaderBorderHR,
g_ListBoxHeaderBorderHG,
g_ListBoxHeaderBorderHB
)
);
m_Divider.x++;
//.........这里部分代码省略.........
示例10: fonts
/*
* changed this to take a filename so we can pass config files on the command line
* default is config.xml
*/
sConfigData::sConfigData(const char *a_filename)
: fonts()
{
DirPath dp = DirPath() << a_filename; // `J` moved to root directory
DirPath dpold = DirPath() << "Resources" << "Data" << a_filename;
string filename = dp.c_str();
string filenameold = dpold.c_str();
l.ss() << "Loading configuration variables from '" << filename << "'"; l.ssend();
/*
* make sure we have something playable,
* even if the file doesn't load
*/
set_defaults();
/*
* open the file - moan most eloqently in its absence
*/
TiXmlDocument doc(filename);
TiXmlDocument docold(filenameold);
if (!doc.LoadFile())
{
l.ss() << "Can't load " << filename << " from root directory." << endl << "Error: line " << doc.ErrorRow() << ", col " << doc.ErrorCol() << ": " << doc.ErrorDesc() << endl << "Attempting to load old file " << filenameold << "." << endl; l.ssend();
doc = docold;
}
if (!doc.LoadFile())
{
l.ss() << "can't load " << filename << endl << "Error: line " << doc.ErrorRow() << ", col " << doc.ErrorCol() << ": " << doc.ErrorDesc(); l.ssend();
/*
* a bit of narrative for the players: makes it easier to tell
* if the config isn't being found
*/
l.ss() << "*** Game will run with default pricing factors.\n*** This may seem a little easy. To fix this\n*** get a config.xml file from pinkpetal.org\n*** or make one with Whore Master Editor"; l.ssend();
return;
}
/*
* get the docuement root
*/
TiXmlElement *el, *root_el = doc.RootElement();
/*
* loop over the elements attached to the root
*/
for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement())
{
string tag = el->ValueStr(); // now, depending on the tag name...
if (el->ValueStr() == "Folders") { get_folders_data(el); continue; }
if (el->ValueStr() == "Resolution") { get_resolution_data(el); continue; }
if (el->ValueStr() == "Initial") { get_initial_values(el); continue; }
if (el->ValueStr() == "Income") { get_income_factors(el); continue; }
if (el->ValueStr() == "Expenses") { get_expense_factors(el); continue; }
if (el->ValueStr() == "Gambling") { get_gambling_factors(el); continue; }
if (el->ValueStr() == "Prostitution") { get_pros_factors(el); continue; }
if (el->ValueStr() == "Catacombs") { get_catacombs_data(el); continue; }
if (el->ValueStr() == "SlaveMarket") { get_slave_market_data(el);continue; }
if (el->ValueStr() == "Pregnancy") { get_preg_factors(el); continue; }
if (el->ValueStr() == "Tax") { get_tax_factors(el); continue; }
if (el->ValueStr() == "Gangs") { get_gang_factors(el); continue; }
if (el->ValueStr() == "Items") { get_item_data(el); continue; }
if (el->ValueStr() == "Fonts") { get_font_data(el); continue; }
if (el->ValueStr() == "Debug") { get_debug_flags(el); continue; }
l.ss() << "Warning: config.xml: tag: '" << tag << "' unexpected"; l.ssend();
}
// check interface for colors
DirPath dpi = DirPath() << "Resources" << "Interface" << resolution.resolution << "InterfaceColors.xml";
TiXmlDocument doci(dpi.c_str());
if (doci.LoadFile())
{
string m_filename = dpi.c_str();
TiXmlElement *el, *root_el = doci.RootElement();
for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement())
{
string tag = el->ValueStr();
if (tag == "Color")
{
XmlUtil xu(m_filename); string name; int r, g, b;
xu.get_att(el, "Name", name); xu.get_att(el, "R", r); xu.get_att(el, "G", g); xu.get_att(el, "B", b);
/* */if (name == "ItemRarity0") ColorConvert.RGBToSDLColor(items.rarity_color[0], r, g, b);
else if (name == "ItemRarity1") ColorConvert.RGBToSDLColor(items.rarity_color[1], r, g, b);
else if (name == "ItemRarity2") ColorConvert.RGBToSDLColor(items.rarity_color[2], r, g, b);
else if (name == "ItemRarity3") ColorConvert.RGBToSDLColor(items.rarity_color[3], r, g, b);
else if (name == "ItemRarity4") ColorConvert.RGBToSDLColor(items.rarity_color[4], r, g, b);
else if (name == "ItemRarity5") ColorConvert.RGBToSDLColor(items.rarity_color[5], r, g, b);
else if (name == "ItemRarity6") ColorConvert.RGBToSDLColor(items.rarity_color[6], r, g, b);
else if (name == "ItemRarity7") ColorConvert.RGBToSDLColor(items.rarity_color[7], r, g, b);
else if (name == "ItemRarity8") ColorConvert.RGBToSDLColor(items.rarity_color[8], r, g, b);
}
}
}
fonts.detailfontsize = 9; // default to 9 then check if it is set in girl_details_screen.xml
DirPath dpt = DirPath() << "Resources" << "Interface" << resolution.resolution << "girl_details_screen.xml";
TiXmlDocument doct(dp.c_str());
if (doct.LoadFile())
{
string m_filename = dpt.c_str();
TiXmlElement *el, *root_el = doct.RootElement();
for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement())
//.........这里部分代码省略.........
示例11: ImagePath
void cScrollBar::LoadInitial()
{ // load static class-wide shared base images into memory; only called once by first scrollbar created
DirPath dp = ImagePath("Scroll");
string disabled = string(dp.c_str()) + "LongDisabled.png";
string off = string(dp.c_str()) + "LongOff.png";
string on = string(dp.c_str()) + "LongOn.png";
string bg = string(dp.c_str()) + "LongBackground.png";
string notches = string(dp.c_str()) + "Notches.png";
m_ImgBarBG = IMG_Load(bg.c_str());
SDL_Surface* TmpImg;
TmpImg = IMG_Load(disabled.c_str());
m_ImgBarDisabled = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(off.c_str());
m_ImgBarOff = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(on.c_str());
m_ImgBarOn = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(notches.c_str());
m_ImgNotches = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
m_NotchOffset = int(((double)m_ImgNotches->h / 2));
string updisabled = string(dp.c_str()) + "UpDisabled.png";
string upoff = string(dp.c_str()) + "UpOff.png";
string upon = string(dp.c_str()) + "UpOn.png";
string downdisabled = string(dp.c_str()) + "DownDisabled.png";
string downoff = string(dp.c_str()) + "DownOff.png";
string downon = string(dp.c_str()) + "DownOn.png";
TmpImg = IMG_Load(updisabled.c_str());
m_ImgButtonUpDisabled = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(upoff.c_str());
m_ImgButtonUpOff = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(upon.c_str());
m_ImgButtonUpOn = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(downdisabled.c_str());
m_ImgButtonDownDisabled = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(downoff.c_str());
m_ImgButtonDownOff = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
TmpImg = IMG_Load(downon.c_str());
m_ImgButtonDownOn = SDL_DisplayFormatAlpha(TmpImg);
SDL_FreeSurface(TmpImg);
}
示例12: DirPath
cScreenBrothelManagement::cScreenBrothelManagement()
{
DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "brothel_management.xml";
m_filename = dp.c_str();
}
示例13: make_dir
bool make_dir(const DirPath& path){
return wxDir::Make(to_wx(path.Str()));
}
示例14: exists
bool exists(const DirPath& path){
return wxDir::Exists(to_wx(path.Str()));
}
示例15: DirPath
cScreenMayor::cScreenMayor()
{
DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "mayor_screen.xml";
m_filename = dp.c_str();
SetBribe = false;
}