Created
April 30, 2012 08:56
-
-
Save zolex/2556694 to your computer and use it in GitHub Desktop.
OpenGLES TTF Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/layout" | |
| android:layout_width="fill_parent" | |
| android:layout_height="fill_parent" | |
| android:background="#000000" > | |
| <android.opengl.GLSurfaceView | |
| android:id="@+id/glview" | |
| android:layout_width="fill_parent" | |
| android:layout_height="fill_parent" /> | |
| <TextView | |
| android:id="@+id/something" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_centerInParent="true" | |
| android:text="" | |
| android:textSize="24dp" /> | |
| </RelativeLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Example Activity | |
| */ | |
| class Xy extends Activity { | |
| public static Typeface font; | |
| public static TextView something; | |
| public void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.glview); // glview.xml | |
| GLSurfaceView glView = (GLSurfaceView)findViewById(R.id.glview); | |
| glView.setRenderer(this); | |
| font = Typeface.createFromAsset(getAssets(), "some_font.ttf"); | |
| something = (TextView)findViewById(R.id.something); | |
| something.setTypeface(font); | |
| } | |
| public void onDrawFrame(GL10 unused) { | |
| this.unOnUiThread(new Runnable() { | |
| public void run() { | |
| Xy.something.setText("i'm looking good!"); | |
| } | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment