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


C++ Texture::setSmooth方法代码示例

本文整理汇总了C++中sf::Texture::setSmooth方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::setSmooth方法的具体用法?C++ Texture::setSmooth怎么用?C++ Texture::setSmooth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sf::Texture的用法示例。


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

示例1: Entity

GraphicalEntity::GraphicalEntity(Scene *scene, std::string entityType, sf::Texture &texture) : Entity(scene, entityType), Sprite(texture)
{
    movingHorizontal = 0;
    movingVertical = 0;
    velocity = 0;
    setPosition(0,0);
    texture.setSmooth(true);
}
开发者ID:mpiniarski,项目名称:arkanoid,代码行数:8,代码来源:GraphicalEntity.cpp

示例2: init

void WindowCreateThing::init(sf::RenderWindow &window) {

    rectTitle.setSize(sf::Vector2f(window.getSize().x*0.45, window.getSize().y*0.07));
    rectTitle.setPosition(sf::Vector2f(window.getSize().x/2-(rectTitle.getSize().x/2), window.getSize().x/4-(rectTitle.getSize().y/2)));
    rectTitle.setFillColor(sf::Color(158, 158, 158));
    rectTitle.setOutlineColor(sf::Color::Black);
    rectTitle.setOutlineThickness(1.f);

    rectMain.setSize(sf::Vector2f(window.getSize().x*0.45,window.getSize().y*0.45));
    rectMain.setPosition(sf::Vector2f(rectTitle.getPosition().x, rectTitle.getPosition().y+rectTitle.getSize().y));
    rectMain.setFillColor(sf::Color::White);
    rectMain.setOutlineColor(sf::Color::Black);
    rectMain.setOutlineThickness(1.f);

    load();


    starting_position = sf::Mouse::getPosition(window);



    textTitle.setFont(font);
    textTitle.setString("CreateThings.txt");
    textTitle.setCharacterSize(24);
    textTitle.setColor(sf::Color::White);
    textTitle.setPosition(sf::Vector2f(rectTitle.getPosition().x+rectTitle.getSize().x*0.3, rectTitle.getPosition().y+rectTitle.getSize().y*0.1));
    //textTitle.setPosition(sf::Vector2f(400,10));

    textClose.setFont(font);
    textClose.setString("X");
    textClose.setStyle(sf::Text::Bold);
    textClose.setCharacterSize(35);
    textClose.setColor(sf::Color::White);
    textClose.setPosition(sf::Vector2f(rectTitle.getPosition().x+rectTitle.getSize().x-30, rectTitle.getPosition().y+rectTitle.getSize().y*0.05));


    ///// FOLDER ICONE
    textureFolder.setSmooth(true);
    spriteFodler.setTexture(textureFolder);
    sf::Vector2f targetSize(25.0f, 25.0f);
    spriteFodler.setScale(
        targetSize.x / spriteFodler.getLocalBounds().width,
        targetSize.y / spriteFodler.getLocalBounds().height);
    spriteFodler.setPosition(sf::Vector2f(textTitle.getPosition().x-targetSize.x, textTitle.getPosition().y));




    ///// CLOSE ICONE
    /*textureClose.setSmooth(true);
    spriteClose.setTexture(textureClose);
    sf::Vector2f targetSize2(window.getSize().y*0.07, window.getSize().y*0.07);
    spriteClose.setScale(
        targetSize2.x / spriteClose.getLocalBounds().width,
        targetSize2.y / spriteClose.getLocalBounds().height);
    spriteClose.setPosition(rectTitle.getPosition().x+rectTitle.getSize().x-targetSize2.x, rectTitle.getPosition().y);*/
}
开发者ID:3991,项目名称:Game-25486,代码行数:57,代码来源:WindowCreateThing.hpp

示例3:

	Goomba(float i, float j) {
		_rect.setSize(sf::Vector2f(32, 32));
		_rect.setFillColor(sf::Color::Blue);
		if (_textureG.loadFromFile("goomba.png")) {
			_textureG.setSmooth(true);
			_spriteG.setTexture(_textureG);
			_spriteG.setScale(1.9, 1.9);
		}
		_spriteG.setPosition(50, 350);
	}
开发者ID:W0Z4,项目名称:ProjetMario,代码行数:10,代码来源:Goomba.hpp

示例4: updateTexture

    void updateTexture(){
	if (faceup) {
	    face.setSmooth(true);
	    sprite.setTexture(face);
	    std::cout << "loaded Face, ";
	}
	else {
	    back.setSmooth(true);
	    sprite.setTexture(back);
	    std::cout << "loaded Back, ";
	}	
    }
开发者ID:kennysandbum,项目名称:Durak,代码行数:12,代码来源:Durak.cpp

示例5: LoadFromFile

bool Level::LoadFromFile(std::string filename)
{
    TiXmlDocument levelFile(filename.c_str());

	// Загружаем XML-карту
    if(!levelFile.LoadFile())
    {
        std::cout << "Loading level \"" << filename << "\" failed." << std::endl;
        return false;
    }

	// Работаем с контейнером map
    TiXmlElement *map;
    map = levelFile.FirstChildElement("map");

	// Пример карты: <map version="1.0" orientation="orthogonal"
	// width="10" height="10" tilewidth="34" tileheight="34">
    width = atoi(map->Attribute("width"));
    height = atoi(map->Attribute("height"));
    tileWidth = atoi(map->Attribute("tilewidth"));
    tileHeight = atoi(map->Attribute("tileheight"));

	// Берем описание тайлсета и идентификатор первого тайла
    TiXmlElement *tilesetElement;
    tilesetElement = map->FirstChildElement("tileset");
    firstTileID = atoi(tilesetElement->Attribute("firstgid"));

	// source - путь до картинки в контейнере image
    TiXmlElement *image;
    image = tilesetElement->FirstChildElement("image");
    std::string imagepath = image->Attribute("source");

	// Пытаемся загрузить тайлсет
	sf::Image img;

    if(!img.loadFromFile(imagepath))
    {
        std::cout << "Failed to load tile sheet." << std::endl;
        return false;
    }


    img.createMaskFromColor(sf::Color(255, 255, 255));
	tilesetImage.loadFromImage(img);
    tilesetImage.setSmooth(false);

	// Получаем количество столбцов и строк тайлсета
	int columns = tilesetImage.getSize().x / tileWidth;
    int rows = tilesetImage.getSize().y / tileHeight;

	// Вектор из прямоугольников изображений (TextureRect)
    std::vector<sf::Rect<int>> subRects;

	for(int y = 0; y < rows; y++)
	for(int x = 0; x < columns; x++)
	{
		sf::Rect<int> rect;

		rect.top = y * tileHeight;
		rect.height = tileHeight;
		rect.left = x * tileWidth;
		rect.width = tileWidth;

		subRects.push_back(rect);
	}

	// Работа со слоями
    TiXmlElement *layerElement;
    layerElement = map->FirstChildElement("layer");
    while(layerElement)
    {
        Layer layer;
		
		// Если присутствует opacity, то задаем прозрачность слоя, иначе он полностью непрозрачен
        if (layerElement->Attribute("opacity") != NULL)
        {
            float opacity = strtod(layerElement->Attribute("opacity"), NULL);
            layer.opacity = 255 * opacity;
        }
        else
        {
            layer.opacity = 255;
        }

		// Контейнер <data>
        TiXmlElement *layerDataElement;
        layerDataElement = layerElement->FirstChildElement("data");

        if(layerDataElement == NULL)
        {
            std::cout << "Bad map. No layer information found." << std::endl;
        }

		// Контейнер <tile> - описание тайлов каждого слоя
        TiXmlElement *tileElement;
        tileElement = layerDataElement->FirstChildElement("tile");

        if(tileElement == NULL)
        {
            std::cout << "Bad map. No tile information found." << std::endl;
//.........这里部分代码省略.........
开发者ID:GlazyrinVladimir,项目名称:Game-STAR-WARS,代码行数:101,代码来源:Level.hpp

示例6: chargerTexture

void chargerTexture(sf::Texture& Texture, std::string filePath)
{
    Texture.setSmooth(false);
    if(!Texture.loadFromFile(filePath))
        std::cerr << "Erreur durant chargement de la texture " << filePath << std::endl;
}
开发者ID:RedDragons,项目名称:v0.1,代码行数:6,代码来源:chargement.cpp


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