Can I run JME in a Fragment? I only saw fullscreen examples.
If yes, how?
Sorry for asking such a dumb question but searching only gives me lots of “fragment shader” stuff.
Can I run JME in a Fragment? I only saw fullscreen examples.
If yes, how?
Sorry for asking such a dumb question but searching only gives me lots of “fragment shader” stuff.
Well it’s been pushed to master 1 or 2 weeks ago. It’s still experimental and you have to use master.
In 3.0 you can’t.
Maybe @iwgeric can tell you more about it.
As @nehon says, jME 3.1 has been switched to use Android Fragment as default. Here is the link to what the file is on 3.1. jME Android Fragment. In addition to using Fragments, the Android layout XML file is now used to size the fragment within the Activity.
Once we go to Alpha (or Beta or whatever it ends up being), you will be able to create a new project in the SDK that is organized this way.
I just found out about this today and will try to get my cardboard stuff working with the fragment instead. Much smoother than the current CardboardHarness
Is the app entirely contained within the fragment?
Yes, the entire app is continental in the fragment.
contained? bad mobile phone completion?
Ha! Yes.
Awesome! Got it working.
I didn’t see anywhere it was actually used, nor a description, so here’s how I did it (using 3.1 trunk):
The Android MainActivity
should now extend Activity
instead of AndroidHarness
.
It seems the preferred way of using AndroidHarnessFragment
is by extending it. This way, you can set the protected fields (most importantly, appClass
) from the constructor.
Create a layout file (here called main.xml
):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<fragment android:name="com.mycompany.mygame.MyAndroidHarnessFragment"
android:id="@+id/game_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
This has our fragment that extends AndroidHarnessFragment
That’s it.
Edit: Published a slightly wordier (and better formatted) version here: http://www.softwarepioneering.com/2015/07/running-jmonkeyengine-3-on-android.html
Are all fragments done Declaratively or Programmatically?
Help me on initializing JMEFragment programmatically in a android Activity and inflating to the defined container.