How do I make TextButtons using LibGDX?

后端 未结 2 1275
长发绾君心
长发绾君心 2021-01-07 14:16

I\'ve followed a few tutorials on youtube to make buttons for my libgdx game and have run into a problem where my button.pack cannot be loaded.

     stage =          


        
2条回答
  •  再見小時候
    2021-01-07 14:44

    The first line of you .pack file refers to the bitmap connected to atlas. I'm pretty sure that what is there is

        button.pack.png
    

    instead of

        button.png
    

    Just edit it and this one should be alright.


    But there's one more problem I see - you use scene2d which is very good and skin instance which is very good too - but why having skin you are creating TextButtonStyle from basics?

    In my opinion you should create your TextButtonStyle using skin mechanism. You can read about it and see some example (even with TextButton) here:

    http://www.gamefromscratch.com/post/2013/12/18/LibGDX-Tutorial-9-Scene2D-Part-3-UI-Skins.aspx

提交回复
热议问题