简体   繁体   English

SFML 2.1纹理

[英]SFML 2.1 textures

I want to see if the texture is bigger than 0 pixels(check if it's displayed) like this: 我想看看纹理是否大于0像素(检查是否已显示),如下所示:

if(image.getSize()>0)

Image is a texture. 图像是纹理。
I get an error saying this: 我收到这样的错误消息:

error: no match for 'operator>' in 'image.sf::Texture::getSize() > 0' 错误:“ image.sf :: Texture :: getSize()> 0”中的“ operator>”不匹配

What does it mean? 这是什么意思? How can I make it work?(if it's possible) 我该如何运作?(如果可能)
If it isn't possible, how do I see if the image is there in the texture? 如果不可能,如何查看纹理中是否存在图像? I'm using SFML 2.1, and CodeBlocks. 我正在使用SFML 2.1和CodeBlocks。
Thanks. 谢谢。

sf::Texture::getSize() returns an sf::Vector2<T> , specifically sf::Vector2u . sf::Texture::getSize()返回sf::Vector2<T> ,特别是sf::Vector2u You should do 你应该做

sf::Vector2u size = image.getSize();
if(size.x > 0 || size.y > 0) ...

or 要么

if(image.getSize() > sf::Vector2u(0, 0)) ...

我找到了方法:使用if(image.getSize().x>0&&image.getSize().y>0)比较x和y。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM