Ú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
- Apple iPhone 14 128GB, Kártyafüggetlen, 1 Év Garanciával
- Gamer félgép - GIGABYTE B450 AORUS + Ryzen 5 5600X + Kingston 2x8GB DDR4 3000MHz + ID-COOLING SE-214
- Samsung U28E590D - 28", 3840 x 2160, 1ms, TN, AMD FreeSync - Eladó!
- MSI RTX 3080 10GB GDDR6X SUPRIM X Eladó!
- GAINWARD RTX 3060 Ti 8GB GDDR6 GHOST OC Eladó!
- Gamer PC-Számítógép! Csere-Beszámítás! R5 5600XT / RTX 3070 / 16GB DDR4 / 512GB Nvme SSD
- iPhone 13 128GB 89% (1év Garancia)
- Apple iPhone 14 Pro 128GB, Kártyafüggetlen, 1 Év Garanciával
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RTX 5070Ti 16GB GAMER PC termékbeszámítással
- BESZÁMÍTÁS! 1TB Samsung 990 PRO heatsink NVMe SSD meghajtó garanciával hibátlan működéssel
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest


