本文整理汇总了C++中HGE::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ HGE::Release方法的具体用法?C++ HGE::Release怎么用?C++ HGE::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HGE
的用法示例。
在下文中一共展示了HGE::Release方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
int CTextAction::execute( CGameState * )
{
HGE *hge = hgeCreate(HGE_VERSION);
float dt = hge->Timer_GetDelta();
int ret = m_textbox->Update(dt);
//DebugMsg("textbox ret: %d\n", ret);
bool lbtndown = hge->Input_KeyDown(HGEK_LBUTTON);
bool spacedown = hge->Input_KeyDown(HGEK_SPACE);
if (ret > 0)
{
if (m_showText && lbtndown)
{
return m_textbox->GetID();
}
if (spacedown)
{
m_showText = !m_showText;
m_textbox->Show(m_showText);
}
}
else
{
if (lbtndown)
{
//m_textbox->SpeedUpLine();
m_textbox->SpeedUpAll();
}
}
hge->Release();
return 0;
}
示例2: Init
void Projectile::Init(Ship* owner, PROJECTILE_TYPE type, float x, float y, float w, bool active)
{
GameObject::Init(x, y, w, active);
this->type = type;
this->owner = owner;
HGE* hge = hgeCreate(HGE_VERSION);
switch (type)
{
case PROJ_BULLET:
{
tex = hge->Texture_Load("missile.png");
sprite.reset(new hgeSprite(tex, 0, 0, 40, 20));
sprite.get()->SetHotSpot(20, 10);
}
break;
case PROJ_SEEKING_MISSLE:
{
tex = hge->Texture_Load("missile.png");
sprite.reset(new hgeSprite(tex, 0, 0, 40, 20));
sprite.get()->SetHotSpot(20, 10);
}
break;
}
hge->Release();
}
示例3: hgeCreate
void StaticMapObj::CollisionEntity::onCollision(iCollisionEntity &o, const iContactInfo &ci)
{
HGE *hge = hgeCreate(HGE_VERSION);
float deltaTime = hge->Timer_GetDelta();
hge->Release();
TankContactInfo &tci = (TankContactInfo &)ci;
Point2f contactPos = tci.getData()->GetContact(0);
Point2f dir = o.getBody().GetPointVelocity(contactPos, deltaTime);
Point2f impulse = dir * 0.001f;// * o.getBody().getMass();
Point2f force = impulse / deltaTime;
getBody().AddForce(force, contactPos);
}
示例4: IsOnControl
bool UIWindow::IsOnControl()
{
if (m_bShow && m_pBackGround)
{
float x,y;
HGE* hge = hgeCreate(HGE_VERSION);
hge->Input_GetMousePos(&x,&y);
if (x>=m_fPosX && x<=(m_fPosX+m_pBackGround->GetWidth()) && y>=m_fPosY && y<=(m_fPosY+m_pBackGround->GetHeight()))
return true;
hge->Release();
}
return false;
}
示例5: 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();
}
示例6: deleted
Missile::Missile(char* filename, float x, float y, float w, int shipid, int _damage)
: angular_velocity(0)
, deleted(0)
, damage(_damage)
{
HGE* hge = hgeCreate(HGE_VERSION);
tex_ = hge->Texture_Load(filename);
hge->Release();
sprite_.reset(new hgeSprite(tex_, 0, 0, 40, 20));
sprite_->SetHotSpot(20,10);
x_ = x;
y_ = y;
w_ = w;
ownerid = shipid;
velocity_x_ = 200.0f * cosf(w_);
velocity_y_ = 200.0f * sinf(w_);
x_ += velocity_x_ * 0.5;
y_ += velocity_y_ * 0.5;
}
示例7: 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();
}
示例8: hgeCreate
Missile::~Missile()
{
HGE* hge = hgeCreate(HGE_VERSION);
hge->Texture_Free(tex_);
hge->Release();
}
示例9: flush
//.........这里部分代码省略.........
//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));
}
break;
}
}
go.clear();
}
hge->Gfx_SetTransform();
hge->Release();
gfxParams.clear();
}