void TileSheetManager::setTileSheet(const string textureName)
{
texture.loadFromFile(textureName);
}
sf::Sprite TileSheetManager::getTile(int left, int top, int width, int height)
{
sf::IntRect subRect;
subRect.left = left * 32;
subRect.top = top * 32;
subRect.width = width;
subRect.height = height;
sf::Sprite sprite(texture, subRect);
return sprite;
}
我需要getTile()
返回一个sf ::纹理但我不知道我该怎么做。
我正在使用SFML2.0。如何让这个函数返回一个sf :: Texture? SFML2.0
是sfml简单而快速的多媒体库?如果是这样,你使用的是哪个版本? http://www.sfml-dev.org/documentation/1.6/annotated.php不包含一个Texture类。这是你自己开发的课程吗? – emartel
我安装了库,这就是我有sf :: Sprite和sf :: IntRect。我说的是,无论如何裁剪像sf :: Sprite sprite(texture,subRect);但用sf :: Texture而不是sf :: Sprite? – user1816388
基本上我想将剪裁纹理的sf ::纹理返回到子目录。 – user1816388