KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here's my code: @Override public void resize(int width, int height) { super.resize(width, height); stage.clear(); // background image Image backImage = new Image(backTexture); backImage.setX(0); backImage.setY(0); backImage.setWidth(800); backImage.setHeight(480); // start game image Image startImage = new Image(startTexture); startImage.setX(415); startImage.setY(180); startImage.setWidth(323); startImage.setHeight(69); stage.addActor(backImage); stage.addActor(startImage); } I'm creating simple game and this is the way I'm creating main menu. I want to make my startImage touchable (clickable) as there is no available listener for Image class. How should I do this? Or is it better to use ImageButton? This way I would have to create image atlas which seems to be a little bit complicated for me now.. EDIT: I tried following: startImage.addListener(new ClickListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { game.setScreen(new SplashScreen(game)); return true; } }); But it still doesn't work.. EDIT: Gdx.input.setInputProcessor(stage); needs to be called. Solved.
Tags (comma-separated)
Save Edits
Cancel