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


C++ setTextureRect函数代码示例

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


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

示例1: setTextureRect

void Sprite::setFlippedX(bool flippedX)
{
    if (_flippedX != flippedX)
    {
        _flippedX = flippedX;
        setTextureRect(_rect, _rectRotated, _contentSize);
    }
}
开发者ID:OscarLeif,项目名称:CCLabelBMFontAnimated,代码行数:8,代码来源:CCSprite.cpp

示例2: setTextureRect

void NSpriteComponent::setTexture(sf::Texture& texture, sf::IntRect const& rect)
{
    mSprite.setTexture(texture);
    if (rect != sf::IntRect())
    {
        setTextureRect(rect);
    }
}
开发者ID:Cmdu76,项目名称:Delmia,代码行数:8,代码来源:SpriteComponent.cpp

示例3: switch

void Asteroid::setRandomImage()
{
	// Pick a random sprite (each size has 6 sprites)
	int x = math::rand(0, 5);
	switch (m_size)
	{
		case BIG:
			setTextureRect(sf::IntRect(0 + x * 48, 0, 48, 48)); // 48*48px
			break;
		case MEDIUM:
			setTextureRect(sf::IntRect(0 + x * 32, 48, 32, 32)); // 32*32px
			break;
		case SMALL:
			setTextureRect(sf::IntRect(192 + x * 16, 48, 16, 16)); // 16*16px
			break;
	}
}
开发者ID:HoekWax,项目名称:cosmoscroll,代码行数:17,代码来源:Asteroid.cpp

示例4: setTexture

void AnimatedSprite::setAnimation(Animation& anim)
{
	//reset();
	animation = anim;
	setTexture(animation.spriteSheet);
	setTextureRect(animation.getFrame(iFrame));
	setOrigin(getTextureRect().width / 2, getTextureRect().height / 2);
}
开发者ID:rzsavilla,项目名称:miniLD62,代码行数:8,代码来源:AnimatedSprite.cpp

示例5: setTexture

	void Drawable::setAnimation(bzsf::Animation& a) {
		setTexture(*a.getTexture());
		setTextureRect(a.getFrameRect());
		
		anim = &a;
		animIndex = anim->getIndex();
		dType = ANIMATION;
	}
开发者ID:BarrensZeppelin,项目名称:bzsf,代码行数:8,代码来源:drawable.cpp

示例6: setTextureRect

AnimatedGraphicElement::AnimatedGraphicElement(const std::vector<sf::IntRect>& clipRects, sf::Texture &image, int x, int y, int w, int h)
    :GraphicElement(image, x, y, w, h)
{
    m_clipRects = clipRects;
    m_clipRect = 0;
    m_nb_etapes = 8;
    m_etape = 0;
    setTextureRect(m_clipRects[m_clipRect]);
}
开发者ID:Cataclyv,项目名称:Runner-View,代码行数:9,代码来源:AnimatedGraphicElement.cpp

示例7: CCLOG

void MainScene::initCollisionSprite() {
    CCLOG("CollisionSprite初期化");
    auto collisionSprite = Sprite::create();
    collisionSprite->setAnchorPoint(Point(0, 0));
    collisionSprite->setTextureRect(Rect(0, 0, 640, 100));
    collisionSprite->setOpacity(0);
    collisionSprite->setPosition(0, 0);
    this->addChild(collisionSprite);
}
开发者ID:neight968,项目名称:TC_FlicGame,代码行数:9,代码来源:MainScene.cpp

示例8: setTexture

 void Sprite::setDisplayFrame(const fzSpriteFrame& spriteFrame)
 {
     if(spriteFrame.isValid()) {
         
         m_unflippedOffset = spriteFrame.getOffset();
         setTexture(spriteFrame.getTexture());
         setTextureRect(spriteFrame.getRect(), spriteFrame.getOriginalSize(), spriteFrame.isRotated());
     }
 }
开发者ID:javierprovecho,项目名称:FORZE2D,代码行数:9,代码来源:FZSprite.cpp

示例9: m_type

PowerUp::PowerUp(Type type):
    m_type(type)
{
    int x = (type % 4) * POWERUP_WIDTH;
    int y = (type / 4) * POWERUP_HEIGHT;

    setTextureRect({x, y, POWERUP_WIDTH, POWERUP_HEIGHT});
    setTexture(Resources::getTexture("power-ups.png"));
}
开发者ID:abodelot,项目名称:wallbreaker,代码行数:9,代码来源:PowerUp.cpp

示例10: setTextureRect

void Shape::setTexture(const Texture* texture, bool resetRect)
{
    // Recompute the texture area if requested, or if there was no texture before
    if (texture && (resetRect || !m_texture))
        setTextureRect(IntRect(0, 0, texture->getWidth(), texture->getHeight()));

    // Assign the new texture
    m_texture = texture;
}
开发者ID:decultured,项目名称:SFML,代码行数:9,代码来源:Shape.cpp

示例11: setTextureRect

void Hero_Digit::Change_Hero_Digit(sf::Event event)
{
	if((event.key.code >= sf::Keyboard::Numpad1 && event.key.code <= sf::Keyboard::Numpad9)
	|| (event.key.code >= sf::Keyboard::Num1 && event.key.code <= sf::Keyboard::Num9))
	{
		number = hero_digit_map[event.key.code];
		setTextureRect(sf::IntRect(((number + 2) % 3) * 100, ((number - 1) / 3) * 100, 100, 100));
	}
}
开发者ID:Averin-Vladislav,项目名称:Oil-Catcher-,代码行数:9,代码来源:Hero_Digit.cpp

示例12: AGameElement

GameDecor::GameDecor(GameDecor const& model)
	: AGameElement(model),/* _image(model.getImage()),*/ _cadre(model.getCadre()), _vector(model.getVector1()), _movement(model.getVector2()) {

	// _texture.loadFromImage(_image);
	// _texture.setRepeated(model.sf::Sprite::getTexture()->isRepeated());
	// _texture.setSmooth(true);
	// setTexture(_texture);
	setTextureRect(_cadre);
}
开发者ID:8102,项目名称:R-Type,代码行数:9,代码来源:GameDecor.cpp

示例13: wyTextureNode

wySpriteEx::wySpriteEx(wyTexture2D* pTex, wyZwoptexFrame* f) : wyTextureNode(pTex) {
    init();

    setTextureRect(f->rect);
    setContentSize(f->sourceSize.width, f->sourceSize.height);
    setRotatedZwoptex(f->rotated);
    m_pointLeftBottom.x = f->sourceSize.width / 2 + f->offset.x - (f->rotated ? f->rect.height : f->rect.width) / 2;
    m_pointLeftBottom.y = f->sourceSize.height / 2 + f->offset.y - (f->rotated ? f->rect.width : f->rect.height) / 2;
}
开发者ID:JMQCode,项目名称:WiEngine,代码行数:9,代码来源:wySpriteEx.cpp

示例14: setTextureRect

	void Drawable::update(sf::Time dt) {
		if(dType == ANIMATION) {
			anim->update(dt);
			if(anim->getIndex() != animIndex) {
				animIndex = anim->getIndex();
				setTextureRect(anim->getFrameRect());
			}
		}
	}
开发者ID:BarrensZeppelin,项目名称:bzsf,代码行数:9,代码来源:drawable.cpp

示例15: setTexture

void Sprite::setTexture(const std::string &filename)
{
    Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
    setTexture(texture);

    Rect rect = Rect::ZERO;
    rect.size = texture->getContentSize();
    setTextureRect(rect);
}
开发者ID:AIRIA,项目名称:CreazyBomber,代码行数:9,代码来源:CCSprite.cpp


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