当前位置: 首页>>代码示例>>C++>>正文


C++ TextureManager::get方法代码示例

本文整理汇总了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();
    }
}
开发者ID:TylerSandman,项目名称:marvin,代码行数:33,代码来源:Bee.cpp

示例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();
		}
	}
开发者ID:Meldow,项目名称:HarudoboirudoNinja,代码行数:35,代码来源:ObjectClue.cpp

示例3: getTexture

const Texture& getTexture(const std::string& path)
{
	if (!textureManager.isLoaded(path))
	{
		textureManager.load(path);
	}
	return textureManager.get(path);
}
开发者ID:chenandy-ca,项目名称:COMP371_Project,代码行数:8,代码来源:TextureManager.cpp

示例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();
}
开发者ID:vsrz,项目名称:CS699,代码行数:8,代码来源:DoorEntity.cpp

示例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);
}
开发者ID:TylerSandman,项目名称:marvin,代码行数:16,代码来源:SnakeSlime.cpp

示例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);
}
开发者ID:InversePalindrome,项目名称:Spacelapse,代码行数:6,代码来源:Projectile.cpp


注:本文中的TextureManager::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。