本文整理汇总了C++中SurfaceSet::getTotalFrames方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceSet::getTotalFrames方法的具体用法?C++ SurfaceSet::getTotalFrames怎么用?C++ SurfaceSet::getTotalFrames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfaceSet
的用法示例。
在下文中一共展示了SurfaceSet::getTotalFrames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
/**
* Draws the medikit view.
*/
void MedikitView::draw()
{
SurfaceSet *set = _game->getMod()->getSurfaceSet("MEDIBITS.DAT");
int fatal_wound = _unit->getFatalWound(_selectedPart);
std::wostringstream ss, ss1;
int green = 0;
int red = 3;
if (_game->getMod()->getInterface("medikit") && _game->getMod()->getInterface("medikit")->getElement("body"))
{
green = _game->getMod()->getInterface("medikit")->getElement("body")->color;
red = _game->getMod()->getInterface("medikit")->getElement("body")->color2;
}
this->lock();
for (unsigned int i = 0; i < set->getTotalFrames(); i++)
{
int wound = _unit->getFatalWound(i);
Surface * surface = set->getFrame (i);
int baseColor = wound ? red : green;
surface->blitNShade(this, Surface::getX(), Surface::getY(), 0, false, baseColor);
}
this->unlock();
_redraw = false;
if (_selectedPart == -1)
{
return;
}
ss << _game->getLanguage()->getString(PARTS_STRING[_selectedPart]);
ss1 << fatal_wound;
_partTxt->setText(ss.str());
_woundTxt->setText(ss1.str());
}
示例2: mouseClick
/**
* Handles clicks on the medikit view.
* @param action Pointer to an action.
* @param state State that the action handlers belong to.
*/
void MedikitView::mouseClick (Action *action, State *)
{
SurfaceSet *set = _game->getMod()->getSurfaceSet("MEDIBITS.DAT");
int x = action->getRelativeXMouse() / action->getXScale();
int y = action->getRelativeYMouse() / action->getYScale();
for (unsigned int i = 0; i < set->getTotalFrames(); i++)
{
Surface * surface = set->getFrame (i);
if (surface->getPixel(x, y))
{
_selectedPart = i;
_redraw = true;
break;
}
}
}