本文整理汇总了C++中HGE::Gfx_SetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ HGE::Gfx_SetTransform方法的具体用法?C++ HGE::Gfx_SetTransform怎么用?C++ HGE::Gfx_SetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HGE
的用法示例。
在下文中一共展示了HGE::Gfx_SetTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void Ant::render(int time)
{
time;
HGE* hge = hgeCreate(HGE_VERSION);
hge->Gfx_SetTransform(0, 0, (float)(int) this->pos.x, (float)(int) this->pos.y, -this->angle, 1, 1);
this->anim->render((int) this->moveMeter, 0);
if (this->carryCake)
{
this->cakeAnim->render(time, 0);
}
hge->Gfx_SetTransform(0, 0, (float)(int) this->pos.x, (float)(int) this->pos.y, 0, 1, 1);
this->hpAnim->render(int(100.0f * this->hp / this->getMaxHp()), 0);
hge->Gfx_SetTransform();
float alpha = (dest - pos).Length() / 50;
DWORD color = int(255 * alpha);
if (color > 255)
color = 255;
color = color << 24 | 0xffffff;
hge->Gfx_RenderLine(this->pos.x, this->pos.y, this->dest.x, this->dest.y, color);
hge->Release();
}
示例2: render
void Bullet::render(int time)
{
HGE *hge = hgeCreate(HGE_VERSION);
hgeVector dir = target - pos;
hgeVector up(0, -1);
if (dir.Length() < 0.5f)
{
dir = up;
}
else
{
dir.Normalize();
}
float angle = dir.Angle(&up);
if (dir.x > 0)
angle = -angle;
hge->Gfx_SetTransform(0, 0, pos.x, pos.y, angle, 1, 1);
anim->render(time, 0);
hge->Release();
}
示例3: flush
void RenderQueue::flush()
{
HGE *hge = hgeCreate(HGE_VERSION);
const Point2f viewerPos = getViewerPos();
const Rectf viewRange = getWindowViewer();
const Rectf windowRange(0, getWindowSize().x, 0, getWindowSize().y);
//Rect clip;
//clip.leftTop = Point2s(100, 100);
//clip.rightBottom = Point2s(200, 200);
hge->Gfx_SetTransform();
for (int i = MaxLayers - 1; i >= 0; --i)
{
vector<GfxObj> &go = gfxobjs[i];
for (size_t j = 0; j < go.size(); ++j)
{
const GfxObj &obj = go[j];
switch(obj.type)
{
case GfxObj::T_Anim:
{
const GfxObj::Data::Anim &anim = obj.data.anim;
Point2f pos = gfxParams.getPoint2f(anim.iA);
if (!anim.screenPos)
pos -= viewerPos;
// FIXME: 100 is magic number, remove it by anim clip range
if (pos.x > windowRange.rightBottom.x + 100 || pos.x < windowRange.leftTop.x - 100 ||
pos.y < windowRange.leftTop.y - 100 || pos.y > windowRange.rightBottom.y + 100)
break;
//hge->Gfx_SetTransform();
hge->Gfx_SetTransform(0, 0, pos.x, pos.y, anim.direction/* - viewerOrientation*/, 1, 1);
anim.anim->render(anim.frame, 0);//&clip);
hge->Gfx_SetTransform();
}
break;
case GfxObj::T_Line:
{
const GfxObj::Data::Line &line = obj.data.line;
const Point2f &posA = gfxParams.getPoint2f(line.iA);
const Point2f &posB = gfxParams.getPoint2f(line.iB);
Rectf objRange(
min(posA.x, posB.x + .1f),
max(posA.x, posB.x + .1f),
min(posA.y, posB.y + .1f),
max(posA.y, posB.y + .1f));
if (line.screenPos)
{
Rectf x = objRange & windowRange;
if (x.Visible())
{
hge->Gfx_RenderLine(posA.x, posA.y,
posB.x, posB.y, line.color);
}
}
else
{
Rectf x = objRange & viewRange;
if (x.Visible())
{
hge->Gfx_RenderLine(posA.x - viewerPos.x, posA.y - viewerPos.y,
posB.x - viewerPos.x, posB.y - viewerPos.y, line.color);
}
}
}
break;
case GfxObj::T_Text:
{
const GfxObj::Data::Text &text = obj.data.text;
Point2f posA = gfxParams.getPoint2f(text.iA);
if (!text.screenPos)
{
posA -= viewerPos;
}
posA = SnapNearestInteger(posA);
//text.font->Render(posA.x, posA.y, text.align, gfxParams.getString(text.iStr).c_str());
renderFontWithBk(*text.font, posA.x, posA.y, ~text.color & 0x00ffffff | 0x40000000, text.color, text.align, gfxParams.getString(text.iStr).c_str());
}
break;
case GfxObj::T_Triple:
{
const GfxObj::Data::Triple &triple = obj.data.triple;
const Point2f &posA = gfxParams.getPoint2f(triple.iA);
if (triple.screenPos)
hge->Gfx_SetTransform(0, 0, posA.x, posA.y, 0, 1, 1);
else
hge->Gfx_SetTransform(0, 0, posA.x - viewerPos.x, posA.y - viewerPos.y, 0, 1, 1);
hge->Gfx_RenderTriple(&gfxParams.getTriple(triple.iTriple));
hge->Gfx_SetTransform();
}
break;
case GfxObj::T_Quad:
{
const GfxObj::Data::Quad &quad = obj.data.quad;
hge->Gfx_RenderQuad(&gfxParams.getQuad(quad.iQuad));
//.........这里部分代码省略.........