Bot* Barracks::clone() { Barracks *b = new Barracks(); b->setSpriteType(getSpriteType()); b->setCurrentState(wstring(L"IDLE_STATE")); b->w=w= (int)(std::ceil((float)(getSpriteType()->getPhysicalW()/TILE_WIDTH))); b->h=h= (int)(std::ceil((float)(getSpriteType()->getPhysicalH()/TILE_HEIGHT))); return b; }
void ScoutTower::render(RenderList* list,Viewport* vp){ Unit::render(list,vp); if(constructionPercent<100){ float x=(body->GetPosition().x*BOX2D_Scale_Factor_INV),y=(body->GetPosition().y*BOX2D_Scale_Factor_INV); float l= x+getSpriteType()->getOffsetX(), t= y+getSpriteType()->getOffsetY(); x-=vp->getViewportX(); y-=vp->getViewportY(); l-=vp->getViewportX(); t-=vp->getViewportY(); int icon =ResourceBankgetResource((string)"PopIconWorld"); for(int i=0;i<workers;i++){ list->addRenderItem(icon, (int)l+8+4*(workers-i), (int)t+8, 0, getAlpha(), 64, 64, getRotTransform(), .5f,.5f ); } float scale = constructionPercent/100; list->addRenderItem(barFill, (int)l, (int)t+10, 0, getAlpha(), 64, 64, getRotTransform(),scale*.5f,1,1 ); list->addRenderItem(barOutline, (int)l, (int)t+10, 0, getAlpha(), 64, 64, getRotTransform(), .5f,.5f, 1 ); } else if(workers>0){ p->pop+=workers*20; workers=0; } }
void Cell::draw(sf::RenderTarget& _target, sf::RenderStates _states) const { Common::InstanceCollection::getInstance<CellSprites>().renderSprite(_target, getSpriteType(), m_XCoordinate, m_YCoordinate); }
void Unit::render(RenderList *list,Viewport *vp){ if(!isVisible())return; float x=(body->GetPosition().x*BOX2D_Scale_Factor_INV),y=(body->GetPosition().y*BOX2D_Scale_Factor_INV); float l= x+getSpriteType()->getOffsetX(), t= y+getSpriteType()->getOffsetY(); if(vp->areWorldCoordinatesInViewport(l,t,getSpriteType()->getTextureWidth(),getSpriteType()->getTextureHeight())){//spriteType->getTextureWidth(),spriteType->getTextureHeight())) x-=vp->getViewportX(); y-=vp->getViewportY(); l-=vp->getViewportX(); t-=vp->getViewportY(); if(selected && Unit::cyclicSelect) list->addRenderItem(SelectedFX::displayID,x-SelectedFX::textureW/2.0f,y-SelectedFX::textureH*.3f,0,255,0,0,0.0f, selectedScaleX,selectedScaleY); list->addRenderItem(this->getCurrentImageID(), (int)l, (int)t, 0, getAlpha(), 64, 64, getRotTransform() ); if(p!=NULL && !isDead()){ list->addRenderItem(p->flagID, (int)l, (int)t, 0, getAlpha(), 64, 64, getRotTransform() ); if(this->displayHPBar()){ list->addRenderItem(p->fillID, (int)l-this->getHPOffX(), (int)t-this->getHPOffY(), 0, getAlpha(), 64, 64, getRotTransform(), this->getHPScaleX()*hp/getMaxHealth(), this->getHPScaleY(), 1 ); list->addRenderItem(UnitHPBar::container, (int)l-this->getHPOffX(), (int)t-this->getHPOffY(), 0, getAlpha(), 64, 64, getRotTransform(), this->getHPScaleX(), this->getHPScaleY(), 1 ); } } renderStatusFX(list,x,y); } }