Bonjour,

Je fais le menu d'un de mes premiers et futurs jeu android, mais me voilà bloqué sur un petit problème:
Détecter le clique d'un texte.
J'ai ce code pour le moment dans mon MainMenu:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.gorlena.managers.GameStateManager;
import com.gorlena.utils.Constants;
 
public class MainMenu extends GameState{
     private Texture background, title;
    private BitmapFont gameTitleText, playText, optionText, creditText;
    private FreeTypeFontGenerator generator;
    private FreeTypeFontGenerator.FreeTypeFontParameter parameter;
 
 
    private GlyphLayout gameTitleGlyph, playGlyph, optionGlyph, creditGlyph;
 
    public MainMenu(GameStateManager gsm) {
        super(gsm);
 
        this.background = new Texture("background.jpg");
        this.title = new Texture("title.png");
 
        this.generator = new FreeTypeFontGenerator(Gdx.files.internal("font.otf"));
        this.parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
 
        this.parameter.size = 128;
 
        this.gameTitleText = this.generator.generateFont(this.parameter);
 
        this.parameter.size = 84;
 
        this.playText = this.generator.generateFont(this.parameter);
        this.parameter.size = 60;
        this.optionText = this.generator.generateFont(this.parameter);
        this.creditText = this.generator.generateFont(this.parameter);
 
        this.gameTitleGlyph = new GlyphLayout();
        this.playGlyph = new GlyphLayout();
        this.optionGlyph = new GlyphLayout();
        this.creditGlyph = new GlyphLayout();
        this.gameTitleGlyph.setText(this.gameTitleText, Constants.GAME_TITLE);
        this.playGlyph.setText(this.playText, "Jouer");
        this.optionGlyph.setText(this.optionText, "Options");
        this.creditGlyph.setText(this.optionText, "Crédits");
 
 
 
        this.cam.setToOrtho(false, Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT);
 
    }
 
    @Override
    protected void handleInput() {
      if() { //La détection du clique sur le texte
 
      }
    }
 
    @Override
    public void update(float dt) {
 
    }
 
    @Override
    public void render(SpriteBatch sb) {
        sb.setProjectionMatrix(this.cam.combined);
        sb.begin();
 
        sb.draw(this.background, 0, 0);
        sb.draw(this.title, this.cam.viewportWidth/2 - this.title.getWidth()/2, this.cam.viewportHeight - this.title.getHeight());
        this.playText.draw(sb, this.playGlyph, this.cam.viewportWidth/2 - this.playGlyph.width/2, this.cam.viewportHeight/3);
        this.optionText.draw(sb, this.optionGlyph, this.cam.viewportWidth/2 - this.optionGlyph.width/2, this.cam.viewportHeight/3 - this.playGlyph.height-10);
        this.creditText.draw(sb, this.creditGlyph, this.cam.viewportWidth/2 - this.creditGlyph.width/2, this.cam.viewportHeight/3 - this.optionGlyph.height-95);
        sb.end();
 
    }
 
    @Override
    public void dispose() {
     this.background.dispose();
        this.title.dispose();
        this.playText.dispose();
        this.gameTitleText.dispose();
        this.optionText.dispose();
        this.creditText.dispose();
        this.generator.dispose();
 
    }
}
La détection doit (Je croix) se faire dans la class handleInput. Je sais faire pour détecter l'appuie d'une touche mais pour un texte. (Gdx.input.isTouched() Pour l’appuie de l'écran par exemple).
J'ai passé 2-3 heures à trouver une solution, sans résultat positif.

Avez vous une solution ?

Merci