最近在研究libgdx,有一起研究的可以讨论讨论
package com.demo;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
//Libgdx的Texture与Sprite使用
public class LibgdxActivity extends AndroidApplication {
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
// 初始化游戏屏幕,并设置是否支持GLES 2.0,如果您对向下兼容没什么需要选择true即可(2.1以上),否则选择false。
// initialize(new FirstGame(), true);
initialize(new Box2DDemo(), true);
}
}
package com.demo;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
public class FirstActor extends Actor{
private Texture texture;
@Override
public void draw(SpriteBatch batch, float arg1) {
batch.draw(texture, this.x, this.y);
}
@Override
public Actor hit(