Libgdx Android项目——图像的绘制1

Libgdx Android项目——图像的绘制1_第1张图片

Libgdx Android项目——图像的绘制1_第2张图片


package com.xuefei.libgdx4;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class GameActivity implements ApplicationListener {

	Stage stage;
	SpriteBatch batch;
	Texture test;
	
	@Override
	public void create() {
		// TODO Auto-generated method stub
		batch = new SpriteBatch();
		test = new Texture(Gdx.files.internal("test.png"));
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
	}

	@Override
	public void render() {
		// TODO Auto-generated method stub
		Gdx.gl.glClearColor(0, 0, 0, 0);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		batch.begin();
		batch.draw(test, 0, 0);
		batch.end();
	}

	@Override
	public void resize(int arg0, int arg1) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

}

发现文件路径直接就在assets下

Libgdx Android项目——图像的绘制1_第3张图片

你可能感兴趣的:(android,libgdx)