2
votes

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 .

1

1 Answers

0
votes

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