i am learning 3d game development on android , i was wondering is it possible to add text areas or any thing that allows a user to enter a text in a 3d world ? and how ?
Your problem have a two part answer :
1 : First you have the problem of letting the user input some text. This can be easily done using the virtual keyboard available in Android. Something like this should do the trick.
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.showSoftInput(v, InputMethodManager.SHOW_FORCED);
Of course if you want something with your own look and feel you can create your own input service (look here for more info http://developer.android.com/resources/articles/creating-input-method.html)
2 : Then, you need to give the user some kind of feedback, meaning write the text the user is typing in 3D. To do this, the basic idea is to create one quad per character, and map it to a texture containing your font, and place the quads in 3D where you wan't them to be.
On android, there are many ways to read strings input:
- As gameloft, develop your own widget and code your own Virtual Keyboard; that is probably the better to way for an immersive experience
- Or use the Android Libraries to do it.
About the second solution:
- in your Layout, there is probably a GLSurfaceView but you can add others views. So you can use an EditText to read input. Just show or hide it when you need it.
- otherwise you don't want use Android View because you have your own GUI. Use only the Virtual Keyboard when needed.
You can read my old tutorial with code and the phil hassey blogs about porting its game from IOS to Android.
we're talking about JNI (Java bridge with C) because our engines are C/C++ code...