My favorites
▼
|
Sign in
android-gamedev
Android Game Development Tutorial Code
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
com
/
badlogic
/
gamedev
/
samples
/
TextSample.java
r71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.badlogic.gamedev.samples;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLU;
import android.os.Bundle;
import com.badlogic.gamedev.tools.Font;
import com.badlogic.gamedev.tools.GameActivity;
import com.badlogic.gamedev.tools.GameListener;
import com.badlogic.gamedev.tools.Font.FontStyle;
import com.badlogic.gamedev.tools.Font.Text;
public class TextSample extends GameActivity implements GameListener
{
Font font;
Text text;
public void onCreate( Bundle bundle )
{
super.onCreate( bundle );
setGameListener( this );
}
@Override
public void setup(GameActivity activity, GL10 gl)
{
font = new Font( gl, activity.getAssets(), "font.ttf", 16, FontStyle.Plain );
text = font.newText( gl );
text.setText( "This is a test string!!" );
}
@Override
public void mainLoopIteration(GameActivity activity, GL10 gl)
{
gl.glViewport( 0, 0, activity.getViewportWidth(), activity.getViewportHeight() );
gl.glClear( GL10.GL_COLOR_BUFFER_BIT );
gl.glMatrixMode( GL10.GL_PROJECTION );
gl.glLoadIdentity();
GLU.gluOrtho2D(gl, 0, activity.getViewportWidth(), 0, activity.getViewportHeight() );
gl.glMatrixMode( GL10.GL_MODELVIEW );
gl.glLoadIdentity();
gl.glTranslatef( 100, 100, 0 );
gl.glEnable( GL10.GL_TEXTURE_2D );
gl.glEnable( GL10.GL_BLEND );
gl.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
text.render();
}
}
Show details
Hide details
Change log
r48
by quantumgame on Jan 13, 2010
Diff
[No log message]
Go to:
/trunk/AndroidManifest.xml
...c/com/badlogic/gamedev/Main.java
.../gamedev/samples/TextSample.java
...nvaders/screens/StartScreen.java
...ceinvaders/simulation/Block.java
...vaders/simulation/Explosion.java
...invaders/simulation/Invader.java
...aceinvaders/simulation/Ship.java
...aders/simulation/Simulation.java
/trunk/tutorial/tutorial.txt
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1472 bytes, 52 lines
View raw file
Powered by
Google Project Hosting