本文整理汇总了C++中TextureManager::get方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::get方法的具体用法?C++ TextureManager::get怎么用?C++ TextureManager::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Entity
Bee::Bee(TextureManager &textureManager, b2Body *enemyBody, float moveVelocity, std::vector<sf::Vector2f> waypoints, float steering) :
Entity(enemyBody),
mMoveVelocity(moveVelocity),
mSteering(steering),
mSeeking(false) {
sf::Texture &spriteSheet = textureManager.get(TextureID::EnemiesSpriteSheet);
Animation animation;
animation.setSpriteSheet(spriteSheet);
animation.addFrame(sf::IntRect(315, 353, 56, 48));
animation.addFrame(sf::IntRect(140, 23, 61, 42));
mAnimation = animation;
mSprite = AnimatedSprite(sf::seconds(0.15f));
mSprite.setAnimation(mAnimation);
sf::FloatRect bounds = mSprite.getLocalBounds();
mSprite.setOrigin(bounds.width/2, bounds.height/2);
mCurrentFacingDirection = Entity::FacingDirection::Left;
if (waypoints.empty())
mSeeking = true;
//Position waypoints according to the bee center
//Rather than absolute top-left coordinates
else {
for (auto &waypoint : waypoints) {
sf::Vector2f platformWaypoint(
waypoint.x + 35.f,
waypoint.y + PX_PER_M - bounds.height / 2.f);
mWaypoints.push_back(platformWaypoint);
}
mCurrentWaypoint = mWaypoints.begin();
}
}
示例2: draw
void ObjectClue::draw() {
if (!_caught) {
if (isDebug()) {
float* color = getBoundingSphere(0)->getColor();
glPushMatrix();
glDisable(GL_LIGHTING);
glColor3f(color[0], color[1], color[2]);
glTranslated(getBoundingSphere(0)->getPosition()[0], getBoundingSphere(0)->getPosition()[1], getBoundingSphere(0)->getPosition()[2]);
glutWireSphere(getBoundingSphere(0)->getRadius(), 20, 20);
glEnable(GL_LIGHTING);
glPopMatrix();
}
TextureManager* tm = dynamic_cast<TextureManager*>( cg::Registry::instance()->get("TextureManager"));
MaterialManager* mm = dynamic_cast<MaterialManager*>( cg::Registry::instance()->get("MaterialManager"));
GLuint txClue = tm->get("clue")->getTextureDL();
glPushMatrix();
glEnable(GL_TEXTURE_2D);
//mm->get("emerald")->apply();
glTranslated(_position[0], _position[1], _position[2] + CLUE_SIZE / 2);
glScalef(CLUE_SIZE, CLUE_SIZE, CLUE_SIZE);
unitCube(txClue);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
}
}
示例3: getTexture
const Texture& getTexture(const std::string& path)
{
if (!textureManager.isLoaded(path))
{
textureManager.load(path);
}
return textureManager.get(path);
}
示例4: Entity
DoorEntity::DoorEntity(const TextureManager& textures, World* world)
: Entity(world)
{
mSprite.setTexture(textures.get(Textures::AutoDoors));
setTilePosition(TilePosition(5,1));
mSprite.setScale(world->getWorldScale());
initalize();
}
示例5: Entity
SnakeSlime::SnakeSlime(TextureManager &textureManager, b2Body *enemyBody) :
Entity(enemyBody){
sf::Texture &spriteSheet = textureManager.get(TextureID::EnemiesSpriteSheet);
Animation wiggleAnimation;
wiggleAnimation.setSpriteSheet(spriteSheet);
wiggleAnimation.addFrame(sf::IntRect(424, 187, 53, 147));
wiggleAnimation.addFrame(sf::IntRect(425, 40, 52, 147));
mAnimation = wiggleAnimation;
mSprite = AnimatedSprite(sf::seconds(0.15f));
mSprite.setAnimation(mAnimation);
sf::FloatRect bounds = mSprite.getLocalBounds();
mSprite.setOrigin(bounds.width/2, bounds.height/2);
}
示例6:
Projectile::Projectile(Type type, TextureManager& textures) :
type(type),
sprite(textures.get(getTexture()))
{
sprite.setOrigin(sprite.getLocalBounds().width / 2.f, sprite.getLocalBounds().height / 2.f);
}