Hirdetés
Új hozzászólás Aktív témák
-
trisztan94
őstag
Valaki meg tudja nekem mondani, hogy az alábbi listener miért nem működik? Se logcat, se console nem dob hibát, még csak warning sincs rá. Semmi. Próbáltam androidon, desktopon is futtatni semmi.
Libgdx-ről lenne szó
TextButton startGameButton = new TextButton( "Start game", getSkin() );
startGameButton.addListener( new InputListener() {
public void touchUp(
InputEvent event,
float x,
float y,
int pointer,
int button )
{
super.touchUp( event, x, y, pointer, button );
game.getSoundManager().play( HowDrunkAreYouSound.CLICK );
//game.setScreen( new StartGameScreen( game ) );
}
} );Mint mondtam, semmi, de semmi nem történik. Hangot teszteltem máshogy, működik, tehát be sem lép a metódusba. Debugger szimplán átugorja.
Ez amúgy egy kicsit módosított kód, ez volt az eredeti amit csórtam:
TextButton optionsButton = new TextButton( "Options", getSkin() );
optionsButton.addListener( new DefaultActorListener() {
@Override
public void touchUp(
ActorEvent event,
float x,
float y,
int pointer,
int button )
{
super.touchUp( event, x, y, pointer, button );
game.getSoundManager().play( TyrianSound.CLICK );
game.setScreen( new OptionsScreen( game ) );
}
} );De ez valszeg a scene2d korábbi verziójával működött, mert hibákat dobál:
.addListener-re: The method addListener(EventListener) in the type Actor is not applicable for the arguments (new DefaultActorListener(){})
new DefaultActorListener() {..}-re : DefaultActorListener cannot be resolved to a type
ActorEvent event-re: ActorEvent cannot be resolved to a type
Nézegettem a scene2d dokumentációját, onnan lestem, hogy mikkel kéne átírni:
"actor.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("down");
return true;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("up");
}
});"Bocsánat, ha nagyon láma kérdés, de egyszerűen semmit sem tudok a jelenséggel kezdeni

Köszönöm!

Új hozzászólás Aktív témák
- Androidos fejegységek
- Kerékpárosok, bringások ide!
- Fecogame: 1 laptop, 1 PC, 2 monitor, 1 hangfal. Hogyan?
- Vicces képek
- iPhone topik
- Huawei P9-P9 Lite OFF topik
- Robotporszívók
- Milyen okostelefont vegyek?
- exHWSW - Értünk mindenhez IS
- Külföldi rendelések: boltok, fizetés, postázás
- További aktív témák...
- BESZÁMÍTÁS! Akár részletfizetés 0% THM ÚJ Intel LGA 1700 processzorok 3 év garanciával 27% áfaval
- BESZÁMÍTÁS! Asus H110M i5 7400 8GB DDR4 120GB SSD 500GB HDD GTX 1050 Ti Formula Air Mesh G3 400W
- AKCIÓ! AMD Ryzen 9 7900X 12 mag 24 szál processzor garanciával hibátlan működéssel
- REFURBISHED és ÚJ - HP Thunderbolt Dock G2 230W with combo cable (3TR87AA)
- AKCIÓ! BESZÁMÍTÁS! Részletfizetés 0% THM ÚJ RTX 5090 több típusban 3 év garanciával 27% áfával
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest



