java - LibGdx:Tween Callback on Tween Engine -
i following following tutorial have created button when write tweencallback should display button @ end of animation. not working , ends splash screen fading in , out. code splash screen.
public class splash implements screen{ private sprite splash; private spritebatch batch; private tweenmanager tweenmanager; @override public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); tweenmanager.update(delta); batch.begin(); splash.draw(batch); batch.end(); } @override public void resize(int width, int height) { } @override public void show() { tweenmanager = new tweenmanager(); tween.registeraccessor(sprite.class, new spriteaccessor()); batch = new spritebatch(); texture splashtexture = new texture ("backgrounds/openingscreen.png"); splash = new sprite(splashtexture); splash.setsize(gdx.graphics.getwidth(), gdx.graphics.getheight()); tween.set(splash, spriteaccessor.alpha).target(0).start(tweenmanager); tween.to(splash, spriteaccessor.alpha, 3f).target(1).repeatyoyo(1, 0f).setcallback(new tweencallback() { @override public void onevent(int type, basetween<?> source) { ((game)gdx.app.getapplicationlistener()).setscreen(new mainmenu()); } }).start(tweenmanager); }
i know problem not button have in main class tried use setscreen (new mainmenu()); , button shows up. here dont understand why wont show up. tutorial works fine , checked code against source code tutorial. ideas? thanks
answer: turns out had commented out initial draw screen in mainmenu class , thats why didn't work
Comments
Post a Comment