void AnimObject::Render() { if (anim) { HGE *hge = hgeCreate(HGE_VERSION); if (!anim->IsPlaying()) anim->Play(); if (anim->GetFrame() < anim->GetFrames() - 1) { if (anim->GetFrame()>0)alreadyplayed = true; anim->RenderEx(imgx, imgy, angle, size, size); anim->Update(hge->Timer_GetDelta()); } else { dead = true; SAFE_DELETE(anim); } if (!dead && alreadyplayed && anim->GetFrame() == 0) { dead = true; SAFE_DELETE(anim); } } }
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; }
bool HGEGame::FrameFunction() { HGE* hge = ((HGEGame*)mInstance)->mHGE; float elapsedTime = hge->Timer_GetDelta(); bool result = mInstance->GetStateManager()->Update(elapsedTime); mInstance->GetScheduler()->Update(elapsedTime); return result; }
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); }
void MUTI_POOL::render() { HGE *hge = hgeCreate(HGE_VERSION); float dt = hge->Timer_GetDelta(); for (int i = 0; i < pool.size(); i++) { pool[i].anim->Update(dt); pool[i].anim->RenderEx(pool[i].GetX(), pool[i].GetY(), 0, pool[i].GetSize(), pool[i].GetSize()); pool[i].lifespan--; if (pool[i].lifespan <= 0) { delete pool.cbegin()->anim; pool.erase(pool.cbegin()); } } }
bool HGEGame::RenderFunction() { HGE* hge = ((HGEGame*)mInstance)->mHGE; HGEGame::mInstance->GetStateManager()->Draw(hge->Timer_GetDelta()); return true; }
void AnimObject::UpdateStep() { HGE *hge = hgeCreate(HGE_VERSION); anim->Update(hge->Timer_GetDelta()); }