Adding libgdx to an Android Native Application

前端 未结 2 1215
走了就别回头了
走了就别回头了 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条回答
  •  旧时难觅i
    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.

提交回复
热议问题