Adding libgdx to an Android Native Application

前端 未结 2 1211
走了就别回头了
走了就别回头了 2021-01-20 17:57

I have a simple kids app which teaches things such as colors, numbers, etc... which I am currently developing. It uses what I would consider \"standard android java programm

相关标签:
2条回答
  • 2021-01-20 18:33

    In Libgdx your entire game is just a single Activity. You can start it as any other activity from your code. Please follow Can I run an Activity before running libgdx? for details.

    0 讨论(0)
  • 2021-01-20 18:42

    You can integrate your App with your libgdx game.
    AndroidLauncher.java is your libgdx Activity and you can move from one activity to another using Intent.

    intent = new Intent(this, AndroidLauncher.class);
    startActivity(intent);
    

    and movement from libgdx AndroidLauncher.java, you need to call it from inside the core project classes. You need to use an interface.

    https://github.com/libgdx/libgdx/wiki/Interfacing-with-platform-specific-code

    If your game is sub view of your App.
    The AndroidApplication class (which extends activity) has a method named initializeForView(ApplicationListener, AndroidApplicationConfiguration) that will return a View you can add to your layout.

    Pros.-Code is already you have,only you need to integrate.
    Cons.-you need to maintain OpenGL Context Loss. Libgdx do for you.

    0 讨论(0)
提交回复
热议问题