本文整理汇总了Java中org.newdawn.slick.opengl.LoadableImageData.getTexWidth方法的典型用法代码示例。如果您正苦于以下问题:Java LoadableImageData.getTexWidth方法的具体用法?Java LoadableImageData.getTexWidth怎么用?Java LoadableImageData.getTexWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.opengl.LoadableImageData
的用法示例。
在下文中一共展示了LoadableImageData.getTexWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: work
import org.newdawn.slick.opengl.LoadableImageData; //导入方法依赖的package包/类
@Override
public Object[] work(String resourceKey) throws PromiseException
{
// avoid the resource cache, AsyncTextureLoader has its own cache
InputStream in = db.getInputStreamSync(resourceKey);
ResourceDB.FileEntry fileEntry = db.getFileEntry(resourceKey);
if (in == null || fileEntry == null)
{
log.log(Level.SEVERE, "Unable to load texture, the given resource key ({0}) does not exist", resourceKey);
throw new InvalidResourceKeyException();
}
String fileName = fileEntry.zipEntry == null ? fileEntry.file.getName() : fileEntry.zipEntry;
LoadableImageData imageData = ImageDataFactory.getImageDataFor(fileName);
try
{
ByteBuffer textureBytes = imageData.loadImage(new BufferedInputStream(in), false, null);
if (textureBytes == null)
{
throw new IOException("loadImage returned null");
}
log.log(Level.INFO, "Texture data for {0} read. {1} {2} {3} {4} {5}", new Object[] {
resourceKey,
imageData.getWidth(),
imageData.getHeight(),
imageData.getDepth(),
imageData.getTexWidth(),
imageData.getTexHeight()
});
return new Object[] {
textureBytes,
imageData.getWidth(),
imageData.getHeight(),
imageData.getDepth(),
imageData.getTexWidth(),
imageData.getTexHeight()
};
}
catch (IOException | UnsatisfiedLinkError | UnsupportedOperationException ex)
{
log.log(Level.SEVERE, "Exception while parsing image for texture " + resourceKey, ex);
throw new PromiseException(ex);
}
}