本文整理汇总了C++中Archive::addNewEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::addNewEntry方法的具体用法?C++ Archive::addNewEntry怎么用?C++ Archive::addNewEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::addNewEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extractAll
/* GfxEntryPanel::extractAll
* Extract all sub-images as individual PNGs
*******************************************************************/
bool GfxEntryPanel::extractAll()
{
if (getImage()->getSize() < 2)
return false;
// Remember where we are
int imgindex = getImage()->getIndex();
Archive* parent = entry->getParent();
if (parent == NULL) return false;
int index = parent->entryIndex(entry, entry->getParentDir());
string name = wxFileName(entry->getName()).GetName();
// Loop through subimages and get things done
int pos = 0;
for (int i = 0; i < getImage()->getSize(); ++i)
{
string newname = S_FMT("%s_%i.png", name, i);
Misc::loadImageFromEntry(getImage(), entry, i);
// Only process images that actually contain some pixels
if (getImage()->getWidth() && getImage()->getHeight())
{
ArchiveEntry* newimg = parent->addNewEntry(newname, index+pos+1, entry->getParentDir());
if (newimg == NULL) return false;
SIFormat::getFormat("png")->saveImage(*getImage(), newimg->getMCData(), gfx_canvas->getPalette());
EntryType::detectEntryType(newimg);
pos++;
}
}
// Reload image of where we were
Misc::loadImageFromEntry(getImage(), entry, imgindex);
return true;
}
示例2: onBtnNewMap
/* MapEditorConfigDialog::onBtnNewMap
* Called when the 'New Map' button is clicked
*******************************************************************/
void MapEditorConfigDialog::onBtnNewMap(wxCommandEvent& e)
{
// Get selected game/port index
int sel_port = choice_port_config->GetSelection() - 1;
if (sel_port >= 0)
sel_port = ports_list[sel_port];
int sel_game = choice_game_config->GetSelection();
// Create new map dialog
NewMapDialog dlg(this, sel_game, sel_port, maps);
// Show it
dlg.SetInitialSize(wxSize(250, -1));
dlg.CenterOnParent();
if (dlg.ShowModal() == wxID_OK)
{
string mapname = dlg.getMapName();
if (mapname.IsEmpty())
return;
// Check the map name isn't already taken
for (unsigned a = 0; a < maps.size(); a++)
{
if (S_CMPNOCASE(maps[a].name, mapname))
{
wxMessageBox("Map " + mapname + " already exists", "Error");
return;
}
}
// Get selected map format
int map_format = MAP_DOOM;
if (dlg.getMapFormat() == "Hexen")
map_format = MAP_HEXEN;
else if (dlg.getMapFormat() == "UDMF")
map_format = MAP_UDMF;
else if (dlg.getMapFormat() == "Doom64")
map_format = MAP_DOOM64;
// Check archive type
if (archive->getType() == ARCHIVE_WAD)
{
// Create new (empty) map at the end of the wad
ArchiveEntry* head = archive->addNewEntry(mapname);
ArchiveEntry* end = NULL;
if (map_format == MAP_UDMF)
{
// UDMF
archive->addNewEntry("TEXTMAP");
end = archive->addNewEntry("ENDMAP");
}
else
{
// Doom(64) / Hexen
archive->addNewEntry("THINGS");
archive->addNewEntry("LINEDEFS");
archive->addNewEntry("SIDEDEFS");
archive->addNewEntry("VERTEXES");
end = archive->addNewEntry("SECTORS");
// Hexen
if (map_format == MAP_HEXEN)
end = archive->addNewEntry("BEHAVIOR");
}
// Refresh map list
populateMapList();
list_maps->selectItem(list_maps->GetItemCount()-1);
}
else if (archive->getType() == ARCHIVE_ZIP
|| archive->getType() == ARCHIVE_FOLDER)
{
// Create new wad archive for the map
Archive* wad = new WadArchive();
// Create new (empty) map at the end of the wad
ArchiveEntry* head = wad->addNewEntry(mapname);
ArchiveEntry* end = NULL;
if (map_format == MAP_UDMF)
{
// UDMF
wad->addNewEntry("TEXTMAP");
end = wad->addNewEntry("ENDMAP");
}
else
{
// Doom(64) / Hexen
wad->addNewEntry("THINGS");
wad->addNewEntry("LINEDEFS");
wad->addNewEntry("SIDEDEFS");
wad->addNewEntry("VERTEXES");
end = wad->addNewEntry("SECTORS");
// Hexen
if (map_format == MAP_HEXEN)
//.........这里部分代码省略.........