本文整理汇总了C++中ImageSet::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageSet::getHeight方法的具体用法?C++ ImageSet::getHeight怎么用?C++ ImageSet::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageSet
的用法示例。
在下文中一共展示了ImageSet::getHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTargetCursor
void LocalPlayer::loadTargetCursor(const std::string &filename,
const int width, const int height,
const bool outRange,
const TargetCursorSize &size)
{
assert(size > -1);
assert(size < 3);
ResourceManager *resman = ResourceManager::getInstance();
ImageSet *currentImageSet = resman->getImageSet(filename, width, height);
Animation *anim = new Animation();
for (unsigned int i = 0; i < currentImageSet->size(); ++i)
{
anim->addFrame(currentImageSet->get(i), 75,
(16 - (currentImageSet->getWidth() / 2)),
(16 - (currentImageSet->getHeight() / 2)));
}
SimpleAnimation *currentCursor = new SimpleAnimation(anim);
const int index = outRange ? 1 : 0;
mTargetCursorImages[index][size] = currentImageSet;
mTargetCursor[index][size] = currentCursor;
}
示例2: if
//.........这里部分代码省略.........
{
mOutput = readParticleEmitterProp(propertyNode, 0);
mOutput.maxVal +=1;
}
else if (name == "output-pause")
{
mOutputPause = readParticleEmitterProp(propertyNode, 0);
mOutputPauseLeft = mOutputPause.value(0);
}
else if (name == "acceleration")
mParticleAcceleration = readParticleEmitterProp(propertyNode, 0.0f);
else if (name == "die-distance")
mParticleDieDistance = readParticleEmitterProp(propertyNode, 0.0f);
else if (name == "momentum")
mParticleMomentum = readParticleEmitterProp(propertyNode, 1.0f);
else if (name == "fade-out")
mParticleFadeOut = readParticleEmitterProp(propertyNode, 0);
else if (name == "fade-in")
mParticleFadeIn = readParticleEmitterProp(propertyNode, 0);
else if (name == "alpha")
mParticleAlpha = readParticleEmitterProp(propertyNode, 1.0f);
else if (name == "follow-parent")
mParticleFollow = true;
else
{
logger->log("Particle Engine: Warning, unknown emitter property \"%s\"",
name.c_str());
}
}
else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter"))
{
ParticleEmitter newEmitter(propertyNode, mParticleTarget, map);
mParticleChildEmitters.push_back(newEmitter);
}
else if (xmlStrEqual(propertyNode->name, BAD_CAST "rotation"))
{
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(propertyNode, "imageset", ""),
XML::getProperty(propertyNode, "width", 0),
XML::getProperty(propertyNode, "height", 0));
// Get animation frames
for_each_xml_child_node(frameNode, propertyNode)
{
int delay = XML::getProperty(frameNode, "delay", 0);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
offsetY -= imageset->getHeight() - mMap->getTileHeight();
offsetX -= (imageset->getWidth() - mMap->getTileWidth()) / 2;
if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
logger->log("No valid value for 'index'");
continue;
}
Image *img = imageset->get(index);
if (!img)
{
logger->log("No image at index %d", index);
continue;
}
mParticleRotation.addFrame(img, delay, offsetX, offsetY);
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
logger->log("No valid value for 'start' or 'end'");
continue;
}
while (end >= start)
{
Image *img = imageset->get(start);
if (!img)
{
logger->log("No image at index %d", start);
continue;
}
mParticleRotation.addFrame(img, delay, offsetX, offsetY);
start++;
}
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
mParticleRotation.addTerminator();
} // for frameNode
}
示例3: initializeAnimation
void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
const std::string& dyePalettes)
{
mInitialized = false;
if (!animationNode)
return;
std::string imagePath = XML::getProperty(animationNode,
"imageset", "");
// Instanciate the dye coloration.
if (!imagePath.empty() && !dyePalettes.empty())
Dye::instantiate(imagePath, dyePalettes);
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
XML::getProperty(animationNode, "width", 0),
XML::getProperty(animationNode, "height", 0)
);
if (!imageset)
return;
// Get animation frames
for (xmlNodePtr frameNode = animationNode->xmlChildrenNode; frameNode;
frameNode = frameNode->next)
{
int delay = XML::getProperty(frameNode, "delay", 0);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
Game *game = Game::instance();
if (game)
{
offsetX -= imageset->getWidth() / 2
- game->getCurrentTileWidth() / 2;
offsetY -= imageset->getHeight() - game->getCurrentTileHeight();
}
if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
logger->log("No valid value for 'index'");
continue;
}
Image *img = imageset->get(index);
if (!img)
{
logger->log("No image at index %d", index);
continue;
}
mAnimation->addFrame(img, delay, offsetX, offsetY);
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
logger->log("No valid value for 'start' or 'end'");
continue;
}
while (end >= start)
{
Image *img = imageset->get(start);
if (!img)
{
logger->log("No image at index %d", start);
continue;
}
mAnimation->addFrame(img, delay, offsetX, offsetY);
start++;
}
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
{
mAnimation->addTerminator();
}
}
mInitialized = true;
}
示例4: if
SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
mAnimationTime(0),
mAnimationPhase(0)
{
mAnimation = new Animation;
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
XML::getProperty(animationNode, "width", 0),
XML::getProperty(animationNode, "height", 0)
);
// Get animation frames
for ( xmlNodePtr frameNode = animationNode->xmlChildrenNode;
frameNode;
frameNode = frameNode->next)
{
int delay = XML::getProperty(frameNode, "delay", 0);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
offsetY -= imageset->getHeight() - 32;
offsetX -= imageset->getWidth() / 2 - 16;
if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
logger->log("No valid value for 'index'");
continue;
}
Image *img = imageset->get(index);
if (!img)
{
logger->log("No image at index %d", index);
continue;
}
mAnimation->addFrame(img, delay, offsetX, offsetY);
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
logger->log("No valid value for 'start' or 'end'");
continue;
}
while (end >= start)
{
Image *img = imageset->get(start);
if (!img)
{
logger->log("No image at index %d", start);
continue;
}
mAnimation->addFrame(img, delay, offsetX, offsetY);
start++;
}
}
else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
{
mAnimation->addTerminator();
}
}
mCurrentFrame = mAnimation->getFrame(0);
}