![](/img/trans.png)
[英]Java LWJGL / Slick-Util texture.bind() binds the same texture everytime
[英]Why does Slick-util's Texture.getWidth() and Texture.getHeight() return a float?
我正在与LWJGL(和油滑使用率)一个游戏,我要使用Texture.getWidth()
和Texture.getHeight()
得到的宽度和高度Texure
宽度对象,而不是打字手动设置高度,但是我发现这些函数返回一个float
。 我想获取Texture
的宽度(以像素为单位),但该函数返回浮点数,因此我不确定该函数实际返回的“单位”,因为像素必须为int
(而不是浮点数,因为您无法渲染a的一半)像素使用一种颜色,另一半使用另一种颜色)。
我可以将它们int
为int
吗?
抱歉,我很快就在Javadocs中查找了Slick-util,从而找到了答案。
要获取原始图像的大小,请使用Texture.getImageWidth()
和Texture.getImageHeight()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.