• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TextureHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TextureHolder的典型用法代码示例。如果您正苦于以下问题:C++ TextureHolder类的具体用法?C++ TextureHolder怎么用?C++ TextureHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextureHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Entity

Tile::Tile(Type type, const TextureHolder& textures)
: Entity(1)
, mType(type)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
, mExplosion(textures.get(Textures::Explosion))
, mDropPickupCommand()
, mShowExplosion(false)
, mSpawnedPickup(false)
, mPickupsEnabled(true)
{
	mExplosion.setFrameSize(sf::Vector2i(256, 256));
	mExplosion.setNumFrames(16);
	mExplosion.setDuration(sf::seconds(1));

	centerOrigin(mSprite);
	centerOrigin(mExplosion);

	mDropPickupCommand.category = Category::SceneFieldLayer;
	mDropPickupCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createPickup(node, textures);
	};


}
开发者ID:ffrujeri,项目名称:SFML-bomberman-clone,代码行数:25,代码来源:Tile.cpp


示例2: Entity

Aircraft::Aircraft(Type type, const TextureHolder& textures, const FontHolder& fonts)
: Entity(Table[type].hitpoints)
, mType(type)
, mFireCommand()
, mMissileCommand()
, mFireCountdown(sf::Time::Zero)
, mIsFiring(false)
, mIsLaunchingMissile(false)
, mShowExplosion(true)
, mSpawnedPickup(false)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
, mExplosion(textures.get(Textures::Explosion))
, mFireRateLevel(1)
, mSpreadLevel(1)
, mMissileAmmo(2)
, mDropPickupCommand()
, mTravelledDistance(0.f)
, mDirectionIndex(0)
, mMissileDisplay(nullptr)
{
	mExplosion.setFrameSize(sf::Vector2i(256, 256));
	mExplosion.setNumFrames(16);
	mExplosion.setDuration(sf::seconds(1));

	centerOrigin(mSprite);
	centerOrigin(mExplosion);

	mFireCommand.category = Category::SceneAirLayer;
	mFireCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createBullets(node, textures);
	};

	mMissileCommand.category = Category::SceneAirLayer;
	mMissileCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createProjectile(node, Projectile::Missile, 0.f, 0.5f, textures);
	};

	mDropPickupCommand.category = Category::SceneAirLayer;
	mDropPickupCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createPickup(node, textures);
	};

	std::unique_ptr<TextNode> healthDisplay(new TextNode(fonts, ""));
	mHealthDisplay = healthDisplay.get();
	attachChild(std::move(healthDisplay));

	if (getCategory() == Category::PlayerAircraft)
	{
		std::unique_ptr<TextNode> missileDisplay(new TextNode(fonts, ""));
		missileDisplay->setPosition(0, 70);
		mMissileDisplay = missileDisplay.get();
		attachChild(std::move(missileDisplay));
	}

	updateTexts();
}
开发者ID:Nyssther,项目名称:SFML-Game-Development-Book,代码行数:59,代码来源:Aircraft.cpp


示例3:

PickupNode::PickupNode(const TextureHolder& textures)
	:spread_sprite(textures.get(Textures::FireSpread), Table[Pickup::FireSpread].texture_rect)
	,rate_sprite(textures.get(Textures::FireRate), Table[Pickup::FireRate].texture_rect)
{
	spread_sprite.setOrigin(spread_sprite.getGlobalBounds().width / 2.f, spread_sprite.getGlobalBounds().width / 2.f);
	rate_sprite.setOrigin(rate_sprite.getGlobalBounds().width / 2.f, rate_sprite.getGlobalBounds().width / 2.f);
	rate_sprite.setPosition(spread_sprite.getPosition().x + 20.f, spread_sprite.getPosition().y);
	spread_sprite.setScale(0.5f, 0.5);
	rate_sprite.setScale(0.5f, 0.5);
}
开发者ID:AniSkyWorker,项目名称:Shoot-Em-Up,代码行数:10,代码来源:PickupNode.cpp


示例4: mWindow

//The constructor for the game class.
Game::Game()
	: mWindow(sf::VideoMode(1366, 768), "Top Down Shooter")
	, mTexture()
	, mPlayer()
{
	TextureHolder textures;
	textures.load(Textures::Airplane, "res/sprite.png");

	mPlayer.setTexture(textures.get(Textures::Airplane));
	mPlayer.setPosition(100, 100);
}
开发者ID:JSGray94,项目名称:SFML_Top_Down_Shooter_2.0,代码行数:12,代码来源:Game.cpp


示例5: mCallback

   Button::Button(const FontHolder& fonts, const TextureHolder& textures)
   : mCallback(),
   mNormalTexture(textures.get(Textures::ButtonNormal)),
   mSelectedTexture(textures.get(Textures::ButtonSelected)),
   mPressedTexture(textures.get(Textures::ButtonPressed)),
   mSprite(),
   mText("", fonts.get(Fonts::Main), 16),
   mIsToggle(false) {

      mSprite.setTexture(mNormalTexture);
      centerOrigin(mSprite);

      mText.setPosition(0, 0);
   }
开发者ID:jordandavidson,项目名称:crows_engine,代码行数:14,代码来源:button.cpp


示例6: mCallback

Button::Button(const FontHolder& fonts, const TextureHolder& textures)
: mCallback()
, mNormalTexture(textures.get(Textures::ButtonNormal))
, mSelectedTexture(textures.get(Textures::ButtonSelected))
, mPressedTexture(textures.get(Textures::ButtonPressed))
, mSprite()
, mText("", fonts.get(Fonts::Main), 16)
, mIsToggle(false)
{
	mSprite.setTexture(mNormalTexture);

	sf::FloatRect bounds = mSprite.getLocalBounds();
	mText.setPosition(bounds.width / 2.f, bounds.height / 2.f);
}
开发者ID:aaronistheman,项目名称:Tanks,代码行数:14,代码来源:Button.cpp


示例7:

Aircraft::Aircraft(Type type, const TextureHolder& textures)
: m_Type(type)
, m_Sprite(textures.get(toTextureID(type)))
{
	sf::FloatRect bounds = m_Sprite.getLocalBounds();
	m_Sprite.setOrigin(bounds.width / 2.f, bounds.height / 2.f);
}
开发者ID:RiordanIX,项目名称:SFML-Learning,代码行数:7,代码来源:Aircraft.cpp


示例8: Entity

Projectile::Projectile(Type type, const TextureHolder& textures) 
	: Entity(1) //1 HP - so it's not detected as destroyed and not drawn
	, type(type)
	, sprite(textures.get(Table[type].texture))
{
	centerOrigin(sprite);
}
开发者ID:medghaim,项目名称:SFML-TopDown-Shooter,代码行数:7,代码来源:Projectile.cpp


示例9: Entity

Pickup::Pickup(Type type, const TextureHolder& textures)
: Entity(1)
, mType(type)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
{
	centerOrigin(mSprite);
}
开发者ID:danielsega,项目名称:Defender,代码行数:7,代码来源:Pickup.cpp


示例10: mType

Person::Person(Type type, const TextureHolder& textures)
: mType(type)
, mSprite(textures.get(toTextureID(type)))
{
    sf::FloatRect bounds = mSprite.getLocalBounds();
    mSprite.setOrigin(bounds.width / 2.f, bounds.height / 2.f);
}
开发者ID:lberezy,项目名称:GameTest,代码行数:7,代码来源:Person.cpp


示例11: Entity

Asteroid::Asteroid(const TextureHolder& textures, b2World& world):
    Entity(createBody(world))
{
    AsteroidGenerator::makeRandomAsteroid(*this);
    m_shape.setTexture(&textures.get(Textures::Asteroid));

    int pointsCount = m_shape.getPointCount();

    b2Vec2 vertices[pointsCount];
    int j = pointsCount - 1;
    for(int i = 0; i < pointsCount; ++i) // CCW
    {
        vertices[j].Set(m_shape.getPoint(i).x / SCALE, m_shape.getPoint(i).y / SCALE);
        j--;
    }

    b2FixtureDef AsteroidFixtureDef;
    b2PolygonShape AsteroidShape;
    AsteroidShape.Set(vertices, pointsCount);
    AsteroidFixtureDef.shape = &AsteroidShape;
    AsteroidFixtureDef.density = 1.0f;
    AsteroidFixtureDef.userData = this;
    m_body->CreateFixture(&AsteroidFixtureDef);

    m_shape.setOrigin(m_body->GetWorldCenter().x, m_body->GetWorldCenter().y);
}
开发者ID:tristanklempka,项目名称:2D-Framework,代码行数:26,代码来源:Asteroid.cpp


示例12: Entity

Aircraft::Aircraft(Type type, const TextureHolder& textures, const FontHolder& fonts)
: Entity(Table[type].hitpoints)
, mType(type), mSprite(textures.get(Table[mType].texture), Table[mType].textRect),mHealthDisplay(nullptr)
, mTravelledDistance(0.f), mDirectionIndex(0), mIsFiring(false), mFireCountdown(sf::Time::Zero)
, mFireRateLevel(1), mFireCommand(), mSpreadLevel(1), mIsMarkedForRemoval(false)
, mMissileCommand(), mIsLaunchMissile(false), mMissileAmmo(2), mDropPickupCommand()
{
    if (!isAllied())
        mFireRateLevel = 0;
    centerOrigin(mSprite);
    
    std::unique_ptr<TextNode>   healthDisplay(new TextNode(fonts, ""));
    mHealthDisplay = healthDisplay.get();
    
    attachChild(std::move(healthDisplay));
    
    mFireCommand.category = Category::Scene;
    mFireCommand.action = [this, &textures](SceneNode& node, sf::Time)
    {
        createBullet(node, textures);
    };
    mMissileCommand.category = Category::Scene;
    mMissileCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
    {
        createProjectile(node, Projectile::Missile, 0.f, 0.5f, textures);
    };
    
    mDropPickupCommand.category = Category::Scene;
    mDropPickupCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
    {
        createPickup(node, textures);
    };
}
开发者ID:kevin5396,项目名称:Hellfire,代码行数:33,代码来源:Aircraft.cpp


示例13: SceneNode

HelpNode::HelpNode(TextureHolder &textures) :
    SceneNode(Category::None),
    mFakePosition(152.f, -2.f)
{
    mSprite.setTexture(textures.get(Textures::Help));
    mSprite.setPosition(150.f, 55.f);
}
开发者ID:Lo-X,项目名称:ludumdare31,代码行数:7,代码来源:helpnode.cpp


示例14: show

DeleteItem::DeleteItem(TextureHolder & textureHolder) : show(false){
	sprite.setTexture(*textureHolder.getTexture(Textures::DeleteItem));
	font.loadFromFile("resources/fonts/00TT.TTF");
	setPosition(1280/2 - sprite.getTextureRect().width/2, 32);
	deleteButton = sf::Rect<int>(getPosition().x + 57, getPosition().y + 61, 67, 25);
	cancelButton = sf::Rect<int>(getPosition().x + 126, getPosition().y + 61, 67, 25);
}
开发者ID:Oscillation,项目名称:oscMrk-II,代码行数:7,代码来源:DeleteItem.cpp


示例15: mParticles

ParticleNode::ParticleNode(Particle::Type type, const TextureHolder& textures)
	: mParticles()
	, mTexture(textures.get(Textures::Particle))
	, mType(type)
	, mVertexArray(sf::Quads)
	, mNeedsVertexUpdate(true)
{
}
开发者ID:MORTAL2000,项目名称:Simple-Super-Mario-,代码行数:8,代码来源:ParticleNode.cpp


示例16: loadTexture

void Player::loadTexture(const TextureHolder& textures)
{
	mAnimation.setTexture(textures.get(Textures::Player));

	setOrigin(0,mSpriteSize.y);


}
开发者ID:Mike920,项目名称:JetX-Platformer-SFML,代码行数:8,代码来源:Player.cpp


示例17: Entity

Projectile::Projectile(Type type, const TextureHolder& textures)
: Entity(1)
, mType(type)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
, mTargetDirection()
{
	centerOrigin(mSprite);
}
开发者ID:lolobster,项目名称:LobsterBall,代码行数:8,代码来源:Projectile.cpp


示例18: spr

Projectile::Projectile(const TextureHolder& textures)
: mType(AlliedBullet)
{
    sf::Sprite spr(textures.get(Textures::Projectile));
    centerOrigin(spr);
    setSprite(spr);
    setID(1);
}
开发者ID:grnnn,项目名称:CS146-Project2,代码行数:8,代码来源:Projectile.cpp


示例19: mPlayer

Paddle::Paddle(const TextureHolder& textures, const bool isPlayer) 
        :   mPlayer(isPlayer)
         , mSprite(textures.get(Textures::Paddle))
      
        
{
        centerOrigin(mSprite);
        
}
开发者ID:devilswin,项目名称:PongGit,代码行数:9,代码来源:Paddle.cpp


示例20: SceneNode

ParticleNode::ParticleNode(Particle::Type type, const TextureHolder &textures) :
    SceneNode(Category::ParticleSystem),
    mParticles(),
    mAffectors(),
    mTexture(textures.get(Textures::Particle)),
    mType(type),
    mVertexArray(sf::Quads),
    mNeedsVertexUpdate(false)
{
}
开发者ID:Lo-X,项目名称:ludumdare31,代码行数:10,代码来源:particlenode.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TextureList类代码示例发布时间:2022-05-31
下一篇:
C++ TextureFrame类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap