java - Programically click on the button in scene 2D LibGDX -
i want programically click on button1 whenever pressed on button2 (after clicked on button2 button1 show style.down style.up , function in clicklistener). found similiar issue on that post doesnt work me.
in android have call performaction()
method, couldnt find similiar method using libgdx library
i figure out :
the solution (inspired this post)
button2.addlistener(new clicklistener(){ @override public boolean touchdown(inputevent event, float x, float y, int pointer, int button) { inputevent event1 = new inputevent(); event1.settype(inputevent.type.touchdown); button1.fire(event1); return true; } @override public void touchup(inputevent event, float x, float y, int pointer, int button) { inputevent event2 = new inputevent(); event2.settype(inputevent.type.touchup); button1.fire(event2); dosmth(); } });
Comments
Post a Comment