简体   繁体   中英

LIBGDX: SpriteBatch draw not drawing on iOS

variables:

int sourceX = 0;

create() method:

texture = new Texture(Gdx.files.internal("background.jpg"));
texture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);

render() method:

batch.begin();
sourceX+=velocitaScorrimentoSfondo;
batch.draw(texture, 0, 0, sourceX, 0, (int) texture.getWidth(), (int) texture.getHeight());
batch.end();

my goal is to run in the background automatically . from left to right . We did but on iOS , when I start the simulator with RoboVM scrolling does not work , that is, I do not see the background . while the simulator genymotion , and , on physical devices Android , the whole works . using the Actor ( Image ) everything works , only the draw will not do. Or if someone advises me how to slide the background Actor , transform the background sliding Actor. It ' may have graphics libraries ? How can I fix ? If you want other code write it in the comments .

Make sure the background texture is a square, and its dimensions are powers of 2, like 256x256, 512x512 or 1024x1024. OpenGL 2.0 compatible devices support drawing textures that do not abide by this rule, but TextureWrapping/Repeating can be problematic.

I had that issue before, here's the badlogicgames forum link to the thread if you're interested.

http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=16695&p=71424#p71424

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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