本文整理汇总了C++中CTexture::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::getHeight方法的具体用法?C++ CTexture::getHeight怎么用?C++ CTexture::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::getHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeSort
/* TextureXListView::sizeSort
* Returns true if texture at index [left] is smaller than [right]
*******************************************************************/
bool TextureXListView::sizeSort(long left, long right)
{
CTexture* tl = ((TextureXListView*)lv_current)->txList()->getTexture(left);
CTexture* tr = ((TextureXListView*)lv_current)->txList()->getTexture(right);
int s1 = tl->getWidth() * tl->getHeight();
int s2 = tr->getWidth() * tr->getHeight();
if (s1 == s2)
return left < right;
else
return lv_current->sortDescend() ? s1 > s2 : s2 > s1;
}
示例2:
CQuad::CQuad(const CTexture & texture) {
const float w = texture.getWidth();
const float h = texture.getHeight();
x0= y0= 0.0f;
x1= w;
y1= h;
u0= v0 = 0.0f;
if (texture.target() == GL_TEXTURE_2D)
u1= v1 = 1.0f;
else {
u1 = w;
v1 = h;
}
}
示例3: 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;
}
示例4: getItemText
/* TextureXListView::getItemText
* Returns the string for [item] at [column]
*******************************************************************/
string TextureXListView::getItemText(long item, long column, long index) const
{
// Check texture list exists
if (!texturex)
return "INVALID INDEX";
// Check index is ok
if (index < 0 || (unsigned)index > texturex->nTextures())
return "INVALID INDEX";
// Get associated texture
CTexture* tex = texturex->getTexture(index);
if (column == 0) // Name column
return tex->getName();
else if (column == 1) // Size column
return S_FMT("%dx%d", tex->getWidth(), tex->getHeight());
else if (column == 2) // Type column
return tex->getType();
else
return "INVALID COLUMN";
}
示例5: writeTEXTUREXData
/* TextureXList::writeTEXTUREXData
* Writes the texture list in TEXTUREX format to [texturex], using
* [patch_table] for patch information. Returns true on success,
* false otherwise
*******************************************************************/
bool TextureXList::writeTEXTUREXData(ArchiveEntry* texturex, PatchTable& patch_table) {
// Check entry was given
if (!texturex)
return false;
if (texturex->isLocked())
return false;
wxLogMessage("Writing " + getTextureXFormatString() + " format TEXTUREx entry");
/* Total size of a TEXTUREx lump, in bytes:
Header: 4 + (4 * numtextures)
Textures:
22 * numtextures (normal format)
14 * numtextures (nameless format)
18 * numtextures (Strife 1.1 format)
Patches:
10 * sum of patchcounts (normal and nameless formats)
6 * sum of patchcounts (Strife 1.1 format)
*/
size_t numpatchrefs = 0;
size_t numtextures = textures.size();
for (size_t i = 0; i < numtextures; ++i) {
numpatchrefs += textures[i]->nPatches();
}
wxLogMessage("%i patch references in %i textures", numpatchrefs, numtextures);
size_t datasize = 0;
size_t headersize = 4 + (4 * numtextures);
switch (txformat) {
case TXF_NORMAL: datasize = 4 + (26 * numtextures) + (10 * numpatchrefs); break;
case TXF_NAMELESS: datasize = 4 + (18 * numtextures) + (10 * numpatchrefs); break;
case TXF_STRIFE11: datasize = 4 + (22 * numtextures) + ( 6 * numpatchrefs); break;
// Some compilers insist on having default cases.
default: return false;
}
MemChunk txdata(datasize);
int32_t* offsets = new int32_t[numtextures];
int32_t foo = wxINT32_SWAP_ON_BE((signed) numtextures);
// Write header
txdata.seek(0, SEEK_SET);
SAFEFUNC(txdata.write(&foo, 4));
// Go to beginning of texture definitions
SAFEFUNC(txdata.seek(4 + (numtextures*4), SEEK_SET));
// Write texture entries
for (size_t i = 0; i < numtextures; ++i) {
// Get texture to write
CTexture* tex = textures[i];
// Set offset
offsets[i] = (signed)txdata.currentPos();
// Write texture entry
switch (txformat) {
case TXF_NORMAL:
{
// Create 'normal' doom format texture definition
ftdef_t txdef;
memset(txdef.name, 0, 8); // Set texture name to all 0's (to ensure compatibility with XWE)
strncpy(txdef.name, CHR(tex->getName().Upper()), tex->getName().Len());
txdef.flags = 0;
txdef.scale[0] = (tex->getScaleX()*8);
txdef.scale[1] = (tex->getScaleY()*8);
txdef.width = tex->getWidth();
txdef.height = tex->getHeight();
txdef.columndir[0] = 0;
txdef.columndir[1] = 0;
txdef.patchcount = tex->nPatches();
// Check for WorldPanning flag
if (tex->world_panning)
txdef.flags |= TX_WORLDPANNING;
// Write texture definition
SAFEFUNC(txdata.write(&txdef, 22));
break;
}
case TXF_NAMELESS:
{
// Create nameless texture definition
nltdef_t txdef;
txdef.flags = 0;
txdef.scale[0] = (tex->getScaleX()*8);
txdef.scale[1] = (tex->getScaleY()*8);
txdef.width = tex->getWidth();
txdef.height = tex->getHeight();
txdef.columndir[0] = 0;
txdef.columndir[1] = 0;
txdef.patchcount = tex->nPatches();
//.........这里部分代码省略.........