void DiffuseCubeDemo::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0)); HR(gd3dDevice->BeginScene()); // Let Direct3D know the vertex buffer, index buffer and vertex // declaration we are using. HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPN))); HR(gd3dDevice->SetIndices(mIB)); HR(gd3dDevice->SetVertexDeclaration(VertexPN::Decl)); // Setup the rendering FX HR(mFX->SetTechnique(mhTech)); HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj))); D3DXMATRIX worldInverseTranspose; D3DXMatrixInverse(&worldInverseTranspose, 0, &mWorld); D3DXMatrixTranspose(&worldInverseTranspose, &worldInverseTranspose); HR(mFX->SetMatrix(mhWorldInverseTranspose, &worldInverseTranspose)); HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3))); HR(mFX->SetValue(mhDiffuseMtrl, &mDiffuseMtrl, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR))); // Begin passes. UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); for(UINT i = 0; i < numPasses; ++i) { HR(mFX->BeginPass(i)); HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12)); HR(mFX->EndPass()); } HR(mFX->End()); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void GunDemo::updateScene(float dt) { mGfxStats->update(dt); gDInput->poll(); gCamera->update(dt, 0, 0); mPSys->update(dt); // Can only fire once every tenth of a second. static float delay = 0.0f; if( gDInput->keyDown(DIK_SPACE) && delay <= 0.0f) { delay = 0.1f; mPSys->addParticle(); } delay -= dt; }
void XFileDemo::drawScene() { HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0)); HR(gd3dDevice->BeginScene()); HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight))); HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj))); D3DXMATRIX worldInvTrans; D3DXMatrixInverse(&worldInvTrans, 0, &mWorld); D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans); HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans)); HR(mFX->SetMatrix(mhWorld, &mWorld)); HR(mFX->SetTechnique(mhTech)); UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); HR(mFX->BeginPass(0)); for (int j = 0; j < mMtrl.size(); ++j) { HR(mFX->SetValue(mhMtrl, &mMtrl[j], sizeof(Material))); if (mTex[j] != 0) { HR(mFX->SetTexture(mhTex, mTex[j])); } else { HR(mFX->SetTexture(mhTex, mWhiteTex)); } HR(mFX->CommitChanges()); HR(mMesh->DrawSubset(j)); } HR(mFX->EndPass()); HR(mFX->End()); mGfxStats->display(D3DCOLOR_XRGB(0,0,0)); HR(gd3dDevice->EndScene()); HR(gd3dDevice->Present(0, 0, 0, 0)); }
void SpotlightDemo::updateScene(float dt) { mGfxStats->update(dt); // Get snapshot of input devices. gDInput->poll(); // Check input. if( gDInput->keyDown(DIK_W) ) mCameraHeight += 25.0f * dt; if( gDInput->keyDown(DIK_S) ) mCameraHeight -= 25.0f * dt; // Divide to make mouse less sensitive. mCameraRotationY += gDInput->mouseDX() / 100.0f; mCameraRadius += gDInput->mouseDY() / 25.0f; // If we rotate over 360 degrees, just roll back to 0 if( fabsf(mCameraRotationY) >= 2.0f * D3DX_PI ) mCameraRotationY = 0.0f; // Don't let radius get too small. if( mCameraRadius < 5.0f ) mCameraRadius = 5.0f; // Control spotlight cone. if( gDInput->keyDown(DIK_G) ) mSpotPower += 25.0f * dt; if( gDInput->keyDown(DIK_H) ) mSpotPower -= 25.0f * dt; // Clamp spot Power. if( mSpotPower < 1.0f ) mSpotPower = 1.0f; if( mSpotPower > 64.0f ) mSpotPower = 64.0f; // The camera position/orientation relative to world space can // change every frame based on input, so we need to rebuild the // view matrix every frame with the latest changes. buildViewMtx(); }
void CubeDemo::drawScene() { HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0)); HR(gd3dDevice->BeginScene()); HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPos))); HR(gd3dDevice->SetIndices(mIB)); HR(gd3dDevice->SetVertexDeclaration(VertexPos::Decl)); D3DXMATRIX W; D3DXMatrixIdentity(&W); HR(gd3dDevice->SetTransform(D3DTS_WORLD, &W)); HR(gd3dDevice->SetTransform(D3DTS_VIEW, &mView)); HR(gd3dDevice->SetTransform(D3DTS_PROJECTION, &mProj)); HR(gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME)); HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12)); mGfxStats->display(D3DCOLOR_XRGB(0,0,0)); HR(gd3dDevice->EndScene()); HR(gd3dDevice->Present(0, 0, 0, 0)); }
void AmbientDiffuseDemo::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0)); HR(gd3dDevice->BeginScene()); // Setup the rendering FX HR(mFX->SetTechnique(mhTech)); HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj))); D3DXMATRIX worldInverseTranspose; D3DXMatrixInverse(&worldInverseTranspose, 0, &mWorld); D3DXMatrixTranspose(&worldInverseTranspose, &worldInverseTranspose); HR(mFX->SetMatrix(mhWorldInverseTranspose, &worldInverseTranspose)); HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3))); HR(mFX->SetValue(mhDiffuseMtrl, &mDiffuseMtrl, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhAmbientMtrl, &mAmbientMtrl, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR))); // Begin passes. UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); for(UINT i = 0; i < numPasses; ++i) { HR(mFX->BeginPass(i)); HR(mTeapot->DrawSubset(0)); HR(mFX->EndPass()); } HR(mFX->End()); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void ProjTexDemo::drawScene() { HR(gd3dDevice->BeginScene()); // Draw sky first--this also replaces our gd3dDevice->Clear call. //mSky->draw(); HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0)); // Draw the scene mesh. HR(mFX->SetTechnique(mhTech)); HR(mFX->SetMatrix(mhWorldInvTrans, &mSceneWorld)); HR(mFX->SetMatrix(mhWorld, &mSceneWorld)); HR(mFX->SetValue(mhLight, &mLight, sizeof(SpotLight))); HR(mFX->SetMatrix(mhWVP, &(mSceneWorld*gCamera->viewProj()))); HR(mFX->SetValue(mhEyePosW, &gCamera->pos(), sizeof(D3DXVECTOR3))); HR(mFX->SetTexture(mhTex, mSkullTex)); HR(mFX->SetMatrix(mhLightWVP, &mLightWVP)); UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); HR(mFX->BeginPass(0)); for(UINT j = 0; j < mSceneMtrls.size(); ++j) { HR(mFX->SetValue(mhMtrl, &mSceneMtrls[j], sizeof(Mtrl))); HR(mFX->CommitChanges()); HR(mSceneMesh->DrawSubset(j)); } HR(mFX->EndPass()); HR(mFX->End()); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void StencilMirrorDemo::updateScene(float dt) { mGfxStats->update(dt); gDInput->poll(); if (gDInput->keyDown(DIK_W)) mCameraHeight += 25.0f * dt; if (gDInput->keyDown(DIK_S)) mCameraHeight -= 25.0f * dt; // divide by 50 to make mouse less sensitive mCameraRotationY += gDInput->mouseDX() / 100.0f; mCameraRadius += gDInput->mouseDY() / 25.0f; if (fabsf(mCameraRotationY) >= 2.0f * D3DX_PI) mCameraRotationY = 0.0f; if (mCameraRadius < 3.0f) mCameraRadius = 3.0f; buildViewMtx(); }
void SpotlightDemo::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0)); HR(gd3dDevice->BeginScene()); // Setup the rendering FX HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhSpecLight, &mSpecLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhAttenuation012, &mAttenuation012, sizeof(D3DXVECTOR3))); HR(mFX->SetFloat(mhSpotPower, mSpotPower)); // Begin passes. UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); for(UINT i = 0; i < numPasses; ++i) { HR(mFX->BeginPass(i)); drawGrid(); drawCylinders(); drawSpheres(); HR(mFX->EndPass()); } HR(mFX->End()); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void GateDemo::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0)); HR(gd3dDevice->BeginScene()); // Setup the rendering FX HR(mFX->SetTechnique(mhTech)); HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3))); HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR))); HR(mFX->SetValue(mhSpecularLight, &mSpecularLight, sizeof(D3DXCOLOR))); drawGround(); drawGate(); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void GfxStatsDemo::onLostDevice() { mGfxStats->onLostDevice(); }
void RobotArmDemo::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0)); HR(gd3dDevice->BeginScene()); HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight))); HR(mFX->SetTechnique(mhTech)); UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); HR(mFX->BeginPass(0)); // Build the world transforms for each bone, then render them. buildBoneWorldTransforms(); D3DXMATRIX T; D3DXMatrixTranslation(&T, -NUM_BONES, 0.0f, 0.0f); for(int i = 0; i < NUM_BONES; ++i) { // Append the transformation with a slight translation to better // center the skeleton at the center of the scene. mWorld = mBones[i].toWorldXForm * T; HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj))); D3DXMATRIX worldInvTrans; D3DXMatrixInverse(&worldInvTrans, 0, &mWorld); D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans); HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans)); HR(mFX->SetMatrix(mhWorld, &mWorld)); for(int j = 0; j < mMtrl.size(); ++j) { HR(mFX->SetValue(mhMtrl, &mMtrl[j], sizeof(Mtrl))); // If there is a texture, then use. if(mTex[j] != 0) { HR(mFX->SetTexture(mhTex, mTex[j])); } // But if not, then set a pure white texture. When the texture color // is multiplied by the color from lighting, it is like multiplying by // 1 and won't change the color from lighting. else { HR(mFX->SetTexture(mhTex, mWhiteTex)); } HR(mFX->CommitChanges()); HR(mBoneMesh->DrawSubset(j)); } } HR(mFX->EndPass()); HR(mFX->End()); mGfxStats->display(); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void RobotArmDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void MirrorDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void Evolution::drawScene() { // Clear the backbuffer and depth buffer. HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0)); HR(gd3dDevice->BeginScene()); static char buffer[255]; static RECT clientRect = {0, 0, 0, 0}; GetClientRect(mhMainWnd, &clientRect); HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true)); HR(gd3dDevice->SetRenderState(D3DRS_ALPHAREF, 25)); HR(gd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER)); if (foodList.size() != 0 || eggList.size() != 0) drawEggsFood(); if (lifeformList.size() != 0) drawLifeforms(); if (mbDrawInfo) { sprintf(buffer, "Carnivore: %d\n" "Carnivore Parts: %d\n" "Egg Cycle Length: %f\n" "Egg Time Length: %f\n" "Food Cycle Length: %f\n" "Lifetime Length: %f\n" "Sight Distance: %f\n" "Fear Distance: %f\n" "Pursuit Length: %f\n" "Speed: %f", mDrawInfo.carnivore, mDrawInfo.carnivoreParts, mDrawInfo.eggCycleLength, mDrawInfo.eggTimeLength, mDrawInfo.foodCycleLength, mDrawInfo.lifeTimeLength, mDrawInfo.sightDistance, mDrawInfo.fearDistance, mDrawInfo.pursuitLength, mDrawInfo.speed); RECT N = {clientRect.left, clientRect.top+(4*18), clientRect.left+300, clientRect.top+(14*18)}; HR(mFont->DrawText(0, buffer, -1, &N, DT_LEFT | DT_NOCLIP, D3DCOLOR_XRGB(0, 0, 0))); } /*if (foodList.size() + BellyFoods + eggList.size() != mMaxBio || BellyFoods < 0) { sprintf(buffer, "BIOMASS LOST/GAINED"); RECT N = {clientRect.left, clientRect.top+(4*18), clientRect.left+300, clientRect.top+(13*18)}; HR(mFont->DrawText(0, buffer, -1, &N, DT_LEFT | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0))); }*/ mGfxStats->display(); HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, false)); HR(gd3dDevice->EndScene()); // Present the backbuffer. HR(gd3dDevice->Present(0, 0, 0, 0)); }
void Evolution::onLostDevice() { mGfxStats->onLostDevice(); HR(mFont->OnResetDevice()); HR(mFX->OnLostDevice()); }
void TerrainDemo::onLostDevice() { mGfxStats->onLostDevice(); mTerrain->onLostDevice(); }
void DiffuseCubeDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void XFileDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void GunDemo::onLostDevice() { mGfxStats->onLostDevice(); mTerrain->onLostDevice(); mPSys->onLostDevice(); }
void SprinklerDemo::onLostDevice() { mGfxStats->onLostDevice(); mTerrain->onLostDevice(); mPSys->onLostDevice(); }
void GfxStatsDemo::onResetDevice() { mGfxStats->onResetDevice(); }
void GfxStatsDemo::updateScene(float dt) { mGfxStats->update(dt); }
void FireRingDemo::onLostDevice() { mGfxStats->onLostDevice(); mTerrain->onLostDevice(); mPSys->onLostDevice(); }
void Evolution::updateScene(float dt) { gDInput->poll(); mTrueTime = dt; mCoolTime += mTrueTime; //mBellyFoods = 0; mGfxStats->setTriCount((lifeformList.size()+foodList.size()+eggList.size())*2); mGfxStats->setVertexCount((lifeformList.size()+foodList.size()+eggList.size())*4); mGfxStats->update(mTrueTime); dt *= mTimeSpeed; if (gDInput->keyDown(DIK_LEFT) && mCoolTime > 0.1f) { --mTimeSpeed; if (mTimeSpeed < 1.0f) mTimeSpeed = 1.0f; mCoolTime = 0.0f; } if (gDInput->keyDown(DIK_RIGHT) && mCoolTime > 0.1f) { ++mTimeSpeed; if (mTimeSpeed > 30.0f) mTimeSpeed = 30.0f; mCoolTime = 0.0f; } POINT mpos; GetCursorPos(&mpos); ScreenToClient(mhMainWnd, &mpos); //mpos.x -= 400; ////mpos.y = -mpos.y + 300; //D3DXVECTOR4 mousePos; //D3DXVec3Transform(&mousePos, &(D3DXVECTOR3(mpos.x, mpos.y, 0.0f)), &(mView*mProj)); //Mouse position and clicking stuff D3DXVECTOR3 mousePos(0.0f, 0.0f, 0.0f); static float w = (float)md3dPP.BackBufferWidth; static float h = (float)md3dPP.BackBufferHeight; float x = (2.0f*mpos.x/w - 1.0f) / mProj(0,0); float y = (-2.0f*mpos.y/h + 1.0f) / mProj(1,1); D3DXVECTOR3 dir(x, y, 1.0f); D3DXMATRIX invView; D3DXMatrixInverse(&invView, 0, &mView); D3DXVec3TransformNormal(&mousePos, &dir, &invView); D3DXVec3Normalize(&mousePos, &mousePos); float ratio = -mCameraPos.z/mousePos.z; mousePos.x = mousePos.x*ratio + mCameraPos.x; mousePos.y = mousePos.y*ratio + mCameraPos.y; //Zooming in/out // Try making a ray to each of the four corners and go from there if (gDInput->mouseDZ() != 0.0f) { mCameraPos.z += gDInput->mouseDZ()*mTrueTime*400.000f; mCameraPos.x += (gDInput->mouseDZ()*0.5000f*(mousePos.x-mCameraPos.x))*mTrueTime; mCameraPos.y += (gDInput->mouseDZ()*0.5000f*(mousePos.y-mCameraPos.y))*mTrueTime; } if (mbFollow) { mCameraPos.x = mFollowPos.x; mCameraPos.y = mFollowPos.y; } if (mCameraPos.z > -300.0f) mCameraPos.z = -300.0f; if (mCameraPos.z < -MapX) mCameraPos.z = -MapX; if (mCameraPos.x < -HalfMapX-mCameraPos.z/2.0f) mCameraPos.x = -HalfMapX-mCameraPos.z/2.0f; if (mCameraPos.x > HalfMapX+mCameraPos.z/2.0f) mCameraPos.x = HalfMapX+mCameraPos.z/2.0f; if (mCameraPos.y < -HalfMapY-mCameraPos.z*3.0f/8.0f) mCameraPos.y = -HalfMapY-mCameraPos.z*3.0f/8.0f; if (mCameraPos.y > HalfMapY+mCameraPos.z*3.0f/8.0f) mCameraPos.y = HalfMapY+mCameraPos.z*3.0f/8.0f; if (gDInput->mouseButtonDown(0) && mCoolTime > 1.0f) { mbDrawInfo = false; } if (gDInput->mouseButtonDown(1) && mCoolTime > 1.0f) { mbFollow = false; } /*if (gDInput->mouseButtonDown(2) && mCoolTime > 0.4f) // Add rightclick functions { Stat newStat; newStat.carnivoreParts = GetRandFloat()*20 + 1; newStat.eggCycleLength = GetRandFloat()*60.0f; newStat.lifeTimeLength = GetRandFloat()*360.0f; newStat.eggTimeLength = GetRandFloat()*120.0f; newStat.foodCycleLength= GetRandFloat()*90.0f; newStat.speed = GetRandFloat()*40.0f; newStat.sightDistance = GetRandFloat()*20.0f; newStat.fearDistance = GetRandFloat()*30.0f; newStat.pursuitLength = GetRandFloat()*20.0f; newStat.pos = D3DXVECTOR3(mousePos.x, mousePos.y, 0.0f); Egg egg; egg.spawn(newStat); eggList.push_back(egg); mCoolTime = 0.0f; }*/ bool followFlag = true; // Update the lovely lifeforms. std::list<Lifeform>::iterator iLifeform = lifeformList.begin(); while (iLifeform != lifeformList.end()) { iLifeform->updateLifeform(dt, mTrueTime); // Did the mouse CLICK on this lifeform? if ( gDInput->mouseButtonDown(0) ) if (!mbDrawInfo) if (Distance(mousePos, iLifeform->getPosition()) < 10.0f) { mDrawInfo = iLifeform->getStat(); mbDrawInfo = true; mCoolTime = 0.0f; } if ( gDInput->mouseButtonDown(1) ) if (!mbFollow) if (Distance(mousePos, iLifeform->getPosition()) < 10.0f) { mbFollow = true; mFollowNumber = iLifeform->getNameber(); mCoolTime = 0.0f; } if (mbFollow) if (mFollowNumber == iLifeform->getNameber()) { mFollowPos = iLifeform->getPosition(); followFlag = false; } if (iLifeform->isDead()) iLifeform = lifeformList.erase(iLifeform); else ++iLifeform; } if (followFlag && mbFollow) mbFollow = false; // Run through the egg list and update them std::list<Egg>::iterator iEgg = eggList.begin(); while (iEgg != eggList.end()) { iEgg->updateEgg(dt); if (iEgg->isHatched()) iEgg = eggList.erase(iEgg); else ++iEgg; } // Collect total food in stomach! /*std::list<Lifeform>::iterator iCheck = lifeformList.begin(); while (iCheck != lifeformList.end()) { if (iCheck->isDead()) iCheck = lifeformList.erase(iCheck); else { mBellyFoods += iCheck->getStomach(); ++iCheck; } }*/ // Update food and the amount of them //mFoodSpawnTime += dt; //if (mFoodSpawnTime > mFoodSpawnCycleLength && //foodList.size() < mFoodAmount && //while(foodList.size() + mBellyFoods + eggList.size() < mMaxBio) //{ //for (int i=0; i<mFoodAmount; ++i) //{ // Food food; // food.spawn(GetRandPos()); // foodList.push_back(food); //} ///mFoodSpawnTime = 0.0f; //} // Updating the food std::list<Food>::iterator iFood = foodList.begin(); while (iFood != foodList.end()) { if (iFood->isEaten()) iFood = foodList.erase(iFood); else ++iFood; } while(foodList.size() + BellyFoods + eggList.size() < mMaxBio) { Food food; food.spawn(GetRandPos()); foodList.push_back(food); } buildViewMtx(); }
void CameraDemo::onLostDevice() { mGfxStats->onLostDevice(); mTerrain->onLostDevice(); }
void TiledGroundDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void SpotlightDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void MultiTexDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }
void SolarSysDemo::onLostDevice() { mGfxStats->onLostDevice(); HR(mFX->OnLostDevice()); }