在Android应用程序与libgdx载入图像 [英] Load images in Android app with libgdx

查看:148
本文介绍了在Android应用程序与libgdx载入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过创建一个很好的教程简单libgdx游戏捉水桶雨滴。我想了解更多关于使用图像,所以我尝试带宝宝更换雨滴。

I've gone through the nice tutorial that creates a simple libgdx game catching raindrops in a bucket. I want to learn more about using images, so I tried replacing the raindrop with a baby.

当我试装baby.png,我得到以下错误:

When I try loading baby.png, I get the following error:

com.badlogic.gdx.utils.GdxRuntimeException: Texture width and height must be 
powers of two: 60x83

我如何可以加载我想要的任何尺寸的图像?

How can I load an image of whatever size I want?

推荐答案

加载图像写入前..

Texture.setEnforcePotImages(false); 

您可以为此在创建应用程序听者的功能是,如果你不希望创建一个纹理地图的最简单方法。

you may do this in create function of application listner this is the easiest way if you don't want to create a texture atlas

这篇关于在Android应用程序与libgdx载入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆