在没有AndroidApplication的情况下使用LibGdx? [英] Using LibGdx without AndroidApplication?

查看:98
本文介绍了在没有AndroidApplication的情况下使用LibGdx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我只对LibGDX的特定部分感兴趣,即查看3D模型并对其进行动画处理,不需要任何输入或其他功能.

In my project, I am interested only in a particular part of LibGDX, that is viewing 3D model and animating it, no inputs or other functionality is needed.

我需要在RecyclerView.Adapter

经过搜索,我发现需要在AndroidGraphics类中获取view,例如:GLSurfaceView

As I have searched, I found that I need to get the view at AndroidGraphics class, ex: GLSurfaceView

但是,我不知道如何在没有AndroidApplication的情况下进行初始化,这有可能吗?

However, I have no idea how to do the initialization without AndroidApplication, would this be possible?

有什么主意吗?

推荐答案

您可以在android中创建libgdx视图并将其添加到布局中.方法如下:

You can create a libgdx view in android and add it to your layout. Here's how:

AndroidApplicationConfiguration config = new 
AndroidApplicationConfiguration();

View gameView = initializeForView(new Game(this), config); // Game is your libgdx Mainclass 

layout = new RelativeLayout(this); // or your custom layout
layout.addView(gameView);
setContentView(layout);

这篇关于在没有AndroidApplication的情况下使用LibGdx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆