How to add libgdx as a sub view in android -


i have main.xml follows:

  <relativelayout>      ...      <framelayout                     android:id="@+id/panel_sheet"                     android:layout_width="match_parent"                     android:layout_height="match_parent">          <com.libgdx.sheet3dviewgdx                  android:id="@+id/m3d"                 android:layout_width="1000dp"                 android:layout_height="600dp"         />      </framelayout>  ... </relativelayout> 

and main activity class follows:

public class test extends activity {      mainactivity  m3dactivity;      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);     } } 

my gdx class follows extend applicationlistener class rather view.

public class sheet3dviewgdx implements applicationlistener{      @override     public void create() {         inputstream in = gdx.files.internal("data/obj/human3dmodel.obj").read();         model =  objloader.loadobj(in);     }      @override     public void dispose() {     }      @override     public void pause() {     }       @override     public void render() {         gdx.gl.glclearcolor(0.0f, 0.0f, 0.0f, 1.0f);         gdx.gl.glclear(gl10.gl_color_buffer_bit | gl10.gl_depth_buffer_bit);         model.render(gl10.gl_triangles);     }      @override     public void resize(int arg0, int arg1) {         float aspectratio = (float) arg0 / (float) arg1;     }      @override     public void resume() {     } } 

now, how should add sheet3dviewgdx subview in main layout?

the androidapplication class (which extends activity) has method named initializeforview(applicationlistener, androidapplicationconfiguration) return view can add layout.

so test-class can extend androidapplication instead of activity can call method , add view layout.

if that's not option, reason, take @ androidapplication source code does, , mimic that.


Comments

Post a Comment

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -