void HUD::draw() { StaticGameEntity::draw(); _healthBar->draw(); _shootBar->draw(); float windowHeight = getMasterInstance()->_window->getHeight(); float windowWidth = getMasterInstance()->_window->getWidth(); float scaleFactor = 0.40f; this->setPosition(Position3D(windowWidth / 2 - (getINDIEntity()->getRegionWidth()*0.5f) / 2, 0, this->getPosition().getZ())); this->getINDIEntity()->setScale(0.5f, 0.50f); float y = windowHeight - (_healthBar->getINDIEntity()->getRegionHeight() * scaleFactor); _healthBar->setPosition(Position3D(0, y, this->getPosition().getZ())); float x = windowWidth - _shootBar->getINDIEntity()->getRegionWidth() * scaleFactor; _shootBar->setPosition(Position3D(x, y, this->getPosition().getZ())); _healthBar->getINDIEntity()->setScale(scaleFactor, scaleFactor); _shootBar->getINDIEntity()->setScale(scaleFactor, scaleFactor); }
void StaticGameEntity::Destroy() { if (getINDIEntity() != NULL){ getMasterInstance()->_entity2dManager->remove(getINDIEntity()); getMasterInstance()->_surfaceManager->remove(_surface); getINDIEntity()->destroy(); } }
Font::Font(CIndieLib* masterInstance, Position3D position, std::string fondImages, std::string xmlResource, float* deltaTime) :GameEntity(masterInstance, position, fondImages, IND_Surface::newSurface(), deltaTime), _xmlResource(xmlResource) { _indFont = IND_Font::newFont(); getMasterInstance()->_fontManager->add(_indFont, fondImages.c_str(), xmlResource.c_str(), IND_ALPHA, IND_32); }
StaticGameEntity::StaticGameEntity(CIndieLib* masterInstance, Position3D position, const char* resourcePath) :GameEntity(masterInstance, position, resourcePath) { _surface = IND_Surface::newSurface(); getMasterInstance()->_surfaceManager->add(_surface, getResourcePath(), IND_OPAQUE, IND_32); }