\r
package com.badlogic.gdx.helloworld;\r
\r
-import com.badlogic.gdx.Files.FileType;\r
+import com.badlogic.gdx.ApplicationListener;\r
import com.badlogic.gdx.Gdx;\r
-import com.badlogic.gdx.RenderListener;\r
+import com.badlogic.gdx.Files.FileType;\r
+import com.badlogic.gdx.graphics.BitmapFont;\r
import com.badlogic.gdx.graphics.Color;\r
-import com.badlogic.gdx.graphics.Font;\r
-import com.badlogic.gdx.graphics.Font.FontStyle;\r
import com.badlogic.gdx.graphics.GL10;\r
import com.badlogic.gdx.graphics.SpriteBatch;\r
import com.badlogic.gdx.graphics.Texture;\r
import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
import com.badlogic.gdx.math.Vector2;\r
\r
-public class HelloWorld implements RenderListener {\r
+public class HelloWorld implements ApplicationListener {\r
boolean initialized = false;\r
SpriteBatch spriteBatch;\r
Texture texture;\r
- Font font;\r
+ BitmapFont font;\r
Vector2 textPosition = new Vector2(100, 100);\r
Vector2 textDirection = new Vector2(1, 1);\r
\r
- @Override public void dispose () {\r
+ @Override public void destroy () {\r
\r
}\r
\r
spriteBatch.begin();\r
spriteBatch.draw(texture, centerX - texture.getWidth() / 2, centerY - texture.getHeight() / 2, 0, 0, texture.getWidth(),\r
texture.getHeight(), Color.WHITE);\r
- spriteBatch.drawText(font, "Hello World!", (int)textPosition.x, (int)textPosition.y, Color.RED);\r
+ font.draw(spriteBatch, "Hello World!", (int)textPosition.x, (int)textPosition.y, Color.RED); \r
spriteBatch.end();\r
}\r
\r
- @Override public void surfaceChanged (int width, int height) {\r
+ @Override public void resize (int width, int height) {\r
\r
}\r
\r
- @Override public void surfaceCreated () {\r
+ @Override public void create () {\r
if (!initialized) {\r
- font = Gdx.graphics.newFont("Arial", 32, FontStyle.Plain);\r
+ font = new BitmapFont();\r
texture = Gdx.graphics.newTexture(Gdx.files.getFileHandle("data/badlogic.jpg", FileType.Internal), TextureFilter.MipMap,\r
TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);\r
spriteBatch = new SpriteBatch();\r
}\r
}\r
+\r
+ @Override\r
+ public void pause() {\r
+ \r
+ }\r
+\r
+ @Override\r
+ public void resume() {\r
+ \r
+ }\r
}\r
\r
package com.badlogic.gdx.helloworld;\r
\r
-import com.badlogic.gdx.backends.desktop.JoglApplication;\r
+import com.badlogic.gdx.backends.jogl.JoglApplication;\r
\r
public class HelloWorldDesktop {\r
public static void main (String[] argv) {\r
- JoglApplication app = new JoglApplication("Hello World", 480, 320, false);\r
- app.getGraphics().setRenderListener(new HelloWorld());\r
+ new JoglApplication(new HelloWorld(), "Hello World", 480, 320, false); \r
}\r
}\r