本文整理汇总了C++中AnimationFrame::setHitTestData方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationFrame::setHitTestData方法的具体用法?C++ AnimationFrame::setHitTestData怎么用?C++ AnimationFrame::setHitTestData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationFrame
的用法示例。
在下文中一共展示了AnimationFrame::setHitTestData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bounds
//.........这里部分代码省略.........
{
//duplicate image edges
MemoryTexture& mt = ad.mt;
ImageData tmp;
if (bounds.getY() == 0 && dest.pos.y != 0)
{
tmp = mt.lock(Rect(dest.pos.x, dest.pos.y - 1, src.w, 1));
operations::copy(src.getRect(Rect(0, 0, src.w, 1)), tmp);
}
if (bounds.getHeight() == im.h && dest.getBottom() != mt.getHeight())
{
tmp = mt.lock(Rect(dest.pos.x, dest.pos.y + src.h, src.w, 1));
operations::copy(src.getRect(Rect(0, src.h - 1, src.w, 1)), tmp);
}
if (bounds.getX() == 0 && dest.pos.x != 0)
{
tmp = mt.lock(Rect(dest.pos.x - 1, dest.pos.y, 1, src.h));
operations::copy(src.getRect(Rect(0, 0, 1, src.h)), tmp);
}
if (bounds.getWidth() == im.w && dest.getRight() != mt.getWidth())
{
tmp = mt.lock(Rect(dest.pos.x + src.w, dest.pos.y, 1, src.h));
operations::copy(src.getRect(Rect(src.w - 1, 0, 1, src.h)), tmp);
}
}
//operations::copy(src.getRect(Rect(0, 0, 1, 1)), mt.lock(&Rect(dest.pos.x - 1, dest.pos.y - 1, 1, 1)));
//operations::copy(src.getRect(Rect(src.w - 1, 0, 1, 1)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y - 1, 1, 1)));
//operations::copy(src.getRect(Rect(0, src.h - 1, 1, 1)), mt.lock(&Rect(dest.pos.x - 1, dest.pos.y + src.h, 1, 1)));
//operations::copy(src.getRect(Rect(src.w - 1, src.h - 1, 1, 1)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y + src.h, 1, 1)));
float iw = 1.0f;
float ih = 1.0f;
RectF srcRect(dest.pos.x * iw, dest.pos.y * ih, dest.size.x * iw, dest.size.y * ih);
Vector2 sizeScaled = Vector2((float)dest.size.x, (float)dest.size.y) * walker.getScaleFactor();
RectF destRect(bounds.pos.cast<Vector2>(), sizeScaled);
AnimationFrame frame;
Diffuse df;
df.base = ad.texture;
df.premultiplied = true;//!Renderer::getPremultipliedAlphaRender();
Vector2 fsize = Vector2((float)frame_width, (float)frame_height) * walker.getScaleFactor();
frame.init2(ra, x, y, df,
srcRect, destRect, fsize);
frame.setHitTestData(adata);
frames.push_back(frame);
}
}
init_resAnim(ra, file, child_node);
ra->init(frames, columns, walker.getScaleFactor(), 1.0f / walker.getScaleFactor());
ra->setParent(this);
context.resources->add(ra, context.options->_shortenIDS);
}
}
applyAtlas(ad, _linearFilter, _clamp2edge);
for (std::vector<ResAnim*>::iterator i = anims.begin(); i != anims.end(); ++i)
{
ResAnim* rs = *i;
int num = rs->getTotalFrames();
for (int n = 0; n < num; ++n)
{
AnimationFrame& frame = const_cast<AnimationFrame&>(rs->getFrame(n));
float iw = 1.0f / frame.getDiffuse().base->getWidth();
float ih = 1.0f / frame.getDiffuse().base->getHeight();
RectF rect = frame.getSrcRect();
rect.pos.x *= iw;
rect.pos.y *= ih;
rect.size.x *= iw;
rect.size.y *= ih;
frame.setSrcRect(rect);
HitTestData ad = frame.getHitTestData();
if (ad.pitch)
{
ad.data = &_hitTestBuffer[reinterpret_cast<size_t>(ad.data)];
frame.setHitTestData(ad);
}
}
}
}