本文整理汇总了C++中CTexture::setState方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::setState方法的具体用法?C++ CTexture::setState怎么用?C++ CTexture::setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::setState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newTextureFromPatch
/* TextureXPanel::newTextureFromPatch
* Creates a new texture called [name] from [patch]. The new texture
* will be set to the dimensions of the patch, with the patch added
* at 0,0
*******************************************************************/
CTexture* TextureXPanel::newTextureFromPatch(string name, string patch)
{
// Create new texture
CTexture* tex = new CTexture();
tex->setName(name);
tex->setState(2);
// Setup texture scale
if (texturex.getFormat() == TXF_TEXTURES)
{
tex->setScale(1, 1);
tex->setExtended(true);
}
else
tex->setScale(0, 0);
// Add patch
tex->addPatch(patch, 0, 0);
// Load patch image (to determine dimensions)
SImage image;
tex->loadPatchImage(0, image);
// Set dimensions
tex->setWidth(image.getWidth());
tex->setHeight(image.getHeight());
// Update variables
modified = true;
// Return the new texture
return tex;
}
示例2: CTexture
TextureModificationUS(TextureXPanel* tx_panel, CTexture* texture)
: tx_panel(tx_panel)
{
tex_copy = new CTexture();
tex_copy->copyTexture(texture);
tex_copy->setState(texture->getState());
index = tx_panel->txList().textureIndex(tex_copy->getName());
}
示例3: newTexture
// -----------------------------------------------------------------------------
// Creates a new, empty texture
// -----------------------------------------------------------------------------
void TextureXPanel::newTexture()
{
// Prompt for new texture name
string name = wxGetTextFromUser("Enter a texture name:", "New Texture");
// Do nothing if no name entered
if (name.IsEmpty())
return;
// Process name
if (!TxListIsTextures(texturex_))
{
name = name.Upper().Truncate(8);
}
// Create new texture
CTexture* tex = new CTexture();
tex->setName(name);
tex->setState(2);
// Default size = 64x128
tex->setWidth(64);
tex->setHeight(128);
// Setup texture scale
if (TxListIsTextures(texturex_))
{
tex->setScale(1, 1);
tex->setExtended(true);
}
else
tex->setScale(0, 0);
// Add it after the last selected item
int selected = list_textures_->getItemIndex(list_textures_->getLastSelected());
if (selected == -1)
selected = texturex_.nTextures() - 1; // Add to end of the list if nothing selected
texturex_.addTexture(tex, selected + 1);
// Record undo level
undo_manager_->beginRecord("New Texture");
undo_manager_->recordUndoStep(new TextureCreateDeleteUS(this, tex, true));
undo_manager_->endRecord(true);
// Update texture list
list_textures_->updateList();
// Select the new texture
list_textures_->clearSelection();
list_textures_->selectItem(selected + 1);
list_textures_->EnsureVisible(selected + 1);
// Update variables
modified_ = true;
}
示例4: modifyOffsets
// -----------------------------------------------------------------------------
// Changes the offsets for each selected texture. Only for ZDoom!
// -----------------------------------------------------------------------------
bool TextureXPanel::modifyOffsets()
{
if (!tx_entry_)
return false;
// saveTEXTUREX();
// Create modify offsets dialog
ModifyOffsetsDialog mod;
mod.SetParent(this);
mod.CenterOnParent();
// Run the dialog
if (mod.ShowModal() == wxID_CANCEL)
return false;
// Go through selection
vector<long> selec_num = list_textures_->getSelection(true);
for (unsigned a = 0; a < selec_num.size(); ++a)
{
// Get texture
bool current = false;
CTexture* ctex = texturex_.getTexture(selec_num[a]);
if (ctex == tex_current_)
{
// Texture is currently open in the editor
ctex = texture_editor_->texture();
current = true;
}
// Calculate and apply new offsets
point2_t offsets =
mod.calculateOffsets(ctex->getOffsetX(), ctex->getOffsetY(), ctex->getWidth(), ctex->getHeight());
ctex->setOffsetX(offsets.x);
ctex->setOffsetY(offsets.y);
ctex->setState(1);
modified_ = true;
// If it was the current texture, update controls
if (current)
texture_editor_->updateTextureControls();
}
return true;
}
示例5: paste
/* TextureXPanel::paste
* Pastes any textures on the clipboard after the last selected
* texture
*******************************************************************/
void TextureXPanel::paste()
{
// Check there is anything on the clipboard
if (theClipboard->nItems() == 0)
return;
// Get last selected index
int selected = list_textures->getLastSelected();
if (selected == -1) selected = texturex.nTextures() - 1; // Add to end of the list if nothing selected
// Begin recording undo level
undo_manager->beginRecord("Paste Texture(s)");
// Go through clipboard items
for (unsigned a = 0; a < theClipboard->nItems(); a++)
{
// Skip if not a texture clipboard item
if (theClipboard->getItem(a)->getType() != CLIPBOARD_COMPOSITE_TEXTURE)
continue;
// Get texture item
TextureClipboardItem* item = (TextureClipboardItem*)(theClipboard->getItem(a));
// Add new texture after last selected item
CTexture* ntex = new CTexture((texturex.getFormat() == TXF_TEXTURES));
ntex->copyTexture(item->getTexture(), true);
ntex->setState(2);
texturex.addTexture(ntex, ++selected);
// Record undo step
undo_manager->recordUndoStep(new TextureCreateDeleteUS(this, ntex, true));
// Deal with patches
for (unsigned p = 0; p < ntex->nPatches(); p++)
{
CTPatch* patch = ntex->getPatch(p);
// Update patch table if necessary
if (texturex.getFormat() != TXF_TEXTURES)
tx_editor->patchTable().addPatch(patch->getName());
// Get the entry for this patch
ArchiveEntry* entry = patch->getPatchEntry(tx_editor->getArchive());
// If the entry wasn't found in any open archive, try copying it from the clipboard
// (the user may have closed the archive the original patch was in)
if (!entry)
{
entry = item->getPatchEntry(patch->getName());
// Copy the copied patch entry over to this archive
if (entry)
tx_editor->getArchive()->addEntry(entry, "patches", true);
}
// If the entry exists in the base resource archive or this archive, do nothing
else if (entry->getParent() == theArchiveManager->baseResourceArchive() ||
entry->getParent() == tx_editor->getArchive())
continue;
// Otherwise, copy the entry over to this archive
else
tx_editor->getArchive()->addEntry(entry, "patches", true);
}
}
// End recording undo level
undo_manager->endRecord(true);
// Refresh
list_textures->updateList();
// Update variables
modified = true;
}