1. <legend id='g6xxe'><style id='g6xxe'><dir id='g6xxe'><q id='g6xxe'></q></dir></style></legend>
  2. <small id='g6xxe'></small><noframes id='g6xxe'>

    • <bdo id='g6xxe'></bdo><ul id='g6xxe'></ul>

    <i id='g6xxe'><tr id='g6xxe'><dt id='g6xxe'><q id='g6xxe'><span id='g6xxe'><b id='g6xxe'><form id='g6xxe'><ins id='g6xxe'></ins><ul id='g6xxe'></ul><sub id='g6xxe'></sub></form><legend id='g6xxe'></legend><bdo id='g6xxe'><pre id='g6xxe'><center id='g6xxe'></center></pre></bdo></b><th id='g6xxe'></th></span></q></dt></tr></i><div id='g6xxe'><tfoot id='g6xxe'></tfoot><dl id='g6xxe'><fieldset id='g6xxe'></fieldset></dl></div>
    1. <tfoot id='g6xxe'></tfoot>
    2. 按钮 ClickListener 在 LibGDX 游戏中不起作用

      时间:2023-05-19

      <small id='MZNpZ'></small><noframes id='MZNpZ'>

      1. <legend id='MZNpZ'><style id='MZNpZ'><dir id='MZNpZ'><q id='MZNpZ'></q></dir></style></legend>
            <tbody id='MZNpZ'></tbody>
          <tfoot id='MZNpZ'></tfoot>
        • <i id='MZNpZ'><tr id='MZNpZ'><dt id='MZNpZ'><q id='MZNpZ'><span id='MZNpZ'><b id='MZNpZ'><form id='MZNpZ'><ins id='MZNpZ'></ins><ul id='MZNpZ'></ul><sub id='MZNpZ'></sub></form><legend id='MZNpZ'></legend><bdo id='MZNpZ'><pre id='MZNpZ'><center id='MZNpZ'></center></pre></bdo></b><th id='MZNpZ'></th></span></q></dt></tr></i><div id='MZNpZ'><tfoot id='MZNpZ'></tfoot><dl id='MZNpZ'><fieldset id='MZNpZ'></fieldset></dl></div>

                <bdo id='MZNpZ'></bdo><ul id='MZNpZ'></ul>
                本文介绍了按钮 ClickListener 在 LibGDX 游戏中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我正在使用 LibGDX 开发一款 Android 游戏.菜单屏幕中有 4 个按钮,但这些按钮的 ClickListener 不起作用.

                I am developing an Android game using LibGDX. There are 4 buttons in a menu screen, but the ClickListener of these buttons is not working.

                // retrieve the custom skin for our 2D widgets
                Skin skin = super.getSkin();
                
                // create the table actor and add it to the stage
                table = new Table( skin );
                table.width = stage.width();
                table.height = stage.height();
                stage.addActor( table );
                
                // retrieve the table's layout
                TableLayout layout = table.getTableLayout();
                
                // register the button "start game"
                TextButton startGameButton = new TextButton( "Start game", skin );
                startGameButton.addListener( new ClickListener() {
                    @Override
                    public void clicked(InputEvent event, float x, float y) {
                        System.out.println("hiii");
                        Assets.load();
                        // game.getSoundManager().play( TyrianSound.CLICK );
                        game.setScreen( new GameScreen(game) );
                    }
                } );
                
                layout.register( "startGameButton", startGameButton );
                

                如何激活LibGDX中按钮的ClickListener?

                How to activate the ClickListener of a button in LibGDX?

                推荐答案

                你要在舞台上添加按钮并调用

                You have to add the button to the stage and call

                Gdx.input.setInputProcessor(stage);
                

                这篇关于按钮 ClickListener 在 LibGDX 游戏中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:LibGDX - 使用 Modelbuilder.createBox 将单个纹理映射到 下一篇:让 Firebase 使用 java,而不是 Android

                相关文章

                最新文章

                • <bdo id='sMqJK'></bdo><ul id='sMqJK'></ul>

              • <tfoot id='sMqJK'></tfoot>
                <legend id='sMqJK'><style id='sMqJK'><dir id='sMqJK'><q id='sMqJK'></q></dir></style></legend>
                  <i id='sMqJK'><tr id='sMqJK'><dt id='sMqJK'><q id='sMqJK'><span id='sMqJK'><b id='sMqJK'><form id='sMqJK'><ins id='sMqJK'></ins><ul id='sMqJK'></ul><sub id='sMqJK'></sub></form><legend id='sMqJK'></legend><bdo id='sMqJK'><pre id='sMqJK'><center id='sMqJK'></center></pre></bdo></b><th id='sMqJK'></th></span></q></dt></tr></i><div id='sMqJK'><tfoot id='sMqJK'></tfoot><dl id='sMqJK'><fieldset id='sMqJK'></fieldset></dl></div>
                1. <small id='sMqJK'></small><noframes id='sMqJK'>