示例#1
0
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);
		}
	}
}
示例#2
0
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;
}
示例#3
0
文件: Game.cpp 项目: doveiya/isilme
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;
}
示例#4
0
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);
}
示例#5
0
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());
		}

	}


}
示例#6
0
文件: Game.cpp 项目: doveiya/isilme
bool	HGEGame::RenderFunction()
{
	HGE* hge = ((HGEGame*)mInstance)->mHGE;
	HGEGame::mInstance->GetStateManager()->Draw(hge->Timer_GetDelta());
	return true;
}
示例#7
0
void AnimObject::UpdateStep()
{
	HGE *hge = hgeCreate(HGE_VERSION);
	anim->Update(hge->Timer_GetDelta());
}